[Rcpp-devel] non-empty character argument expected

Benjamin Tyner btyner at gmail.com
Fri May 17 04:47:32 CEST 2013


Hello,

I'm getting an error that I'm at a loss to explain; here is my code:

#################################
library(inline)

f1 <- cxxfunction(signature(input = "numeric",
                            parms = "list"
                           ),
                 plugin = "Rcpp",
                 body = '
Rcpp::List Parms(parms);

Rcpp::NumericVector Input(input);

int n = Input.size();

Rcpp::NumericVector output(n);

int i;
for(i=0; i<n; i++){
    Rcpp::NumericVector parm0 = Parms[0];
    output[i] = Input[i] * parm0[0];
}

return wrap(output);
', verbose=TRUE)

set.seed(6860)
n <- 1000000L
x <- runif(n)
p <- list(2)

time.f1 <- system(x2 <- f1(input=x, parms=p))
##################################

here is the output:

##################################

 >> setting environment variables:
PKG_LIBS =  -L/home/btyner/R/x86_64-pc-linux-gnu-library/2.15/Rcpp/lib
-lRcpp -Wl,-rpath,/home/btyner/R/x86_64-pc-linux-gnu-library/2.15/Rcpp/lib

 >> LinkingTo : Rcpp
CLINK_CPPFLAGS = 
-I"/home/btyner/R/x86_64-pc-linux-gnu-library/2.15/Rcpp/include"

 >> Program source :

   1 :
   2 : // includes from the plugin
   3 :
   4 : #include <Rcpp.h>
   5 :
   6 :
   7 : #ifndef BEGIN_RCPP
   8 : #define BEGIN_RCPP
   9 : #endif
  10 :
  11 : #ifndef END_RCPP
  12 : #define END_RCPP
  13 : #endif
  14 :
  15 : using namespace Rcpp;
  16 :
  17 :
  18 : // user includes
  19 :
  20 :
  21 : // declarations
  22 : extern "C" {
  23 : SEXP file135460c2301f( SEXP input, SEXP parms) ;
  24 : }
  25 :
  26 : // definition
  27 :
  28 : SEXP file135460c2301f( SEXP input, SEXP parms ){
  29 : BEGIN_RCPP
  30 :
  31 : Rcpp::List Parms(parms);
  32 :
  33 : Rcpp::NumericVector Input(input);
  34 :
  35 : int n = Input.size();
  36 :
  37 : Rcpp::NumericVector output(n);
  38 :
  39 : int i;
  40 : for(i=0; i<n; i++){
  41 :     Rcpp::NumericVector parm0 = Parms[0];
  42 :     output[i] = Input[i] * parm0[0];
  43 : }
  44 :
  45 : return wrap(output);
  46 :
  47 : END_RCPP
  48 : }
  49 :
  50 :
Compilation argument:
 /usr/lib/R/bin/R CMD SHLIB file135460c2301f.cpp 2>
file135460c2301f.cpp.err.txt
g++ -I/usr/share/R/include -DNDEBUG  
-I"/home/btyner/R/x86_64-pc-linux-gnu-library/2.15/Rcpp/include"  
-fpic  -O2 -pipe -g  -c file135460c2301f.cpp -o file135460c2301f.o
g++ -shared -o file135460c2301f.so file135460c2301f.o
-L/home/btyner/R/x86_64-pc-linux-gnu-library/2.15/Rcpp/lib -lRcpp
-Wl,-rpath,/home/btyner/R/x86_64-pc-linux-gnu-library/2.15/Rcpp/lib
-L/usr/lib/R/lib -lR
Error in system(x2 <- f1(input = x, parms = p)) :
  non-empty character argument expected

#######################

here is my

> sessionInfo()
R version 2.15.2 (2012-10-26)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C             
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8   
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8  
 [7] LC_PAPER=C                 LC_NAME=C                
 [9] LC_ADDRESS=C               LC_TELEPHONE=C           
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C      

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base    

other attached packages:
[1] Rcpp_0.10.3   inline_0.3.11

loaded via a namespace (and not attached):
[1] tools_2.15.2

#########################

Any ideas?

Regards,
Ben



-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2390 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20130516/b2a5de56/attachment.bin>


More information about the Rcpp-devel mailing list