[Rcpp-devel] Bug: RcppArmadillo.package.skeleton builds faulty man/*.Rd files

Dirk Eddelbuettel edd at debian.org
Thu Jul 12 02:32:23 CEST 2012


Nathan,

Two more comments. First, I am not sure you can even do what you did.  When I
call Rcpp.armadillo.package() as (where I omit the R file argument -- no
point including a file loading inline in a package, or redefining these
functions)

  RcppArmadillo.package.skeleton(name='inlineExample',list=c('plus.two.cpp','plus.two.r'))

I get 

R> RcppArmadillo.package.skeleton(name='inlineExample',list=c('plus.two.cpp','plus.two.r'))
Creating directories ...
Creating DESCRIPTION ...
Creating NAMESPACE ...
Creating Read-and-delete-me ...
Saving functions and data ...
Making help files ...
Done.
Further steps are described in './inlineExample/Read-and-delete-me'.

Adding RcppArmadillo settings
 >> added Depends: Rcpp, RcppArmadillo
 >> added LinkingTo: Rcpp, RcppArmadillo
 >> added useDynLib directive to NAMESPACE
 >> added Makevars file with Rcpp settings
 >> added Makevars.win file with RcppArmadillo settings
 >> added example header file using Rcpp/RcppArmadillo
 >> added example src file using armadillo classes
 >> added example R file calling the C++ example
Warning message:
In dump(item, file = file.path(code_dir, sprintf("%s.R", list0[item]))) :
  deparse of an S4 object will not be source()able
R> 


indicating the result from cxxfunction() will not be representable. And
indeed:

edd at max:/tmp$ R CMD INSTALL inlineExample
* installing to library ‘/usr/local/lib/R/site-library’
* installing *source* package ‘inlineExample’ ...
** libs
ccache g++-4.6 -I/usr/share/R/include -DNDEBUG   -I"/usr/local/lib/R/site-library/Rcpp/include" -I"/usr/local/lib/R/site-library/RcppArmadillo/include"   -fpic  -g -O0 -Wall -c rcpparma_hello_world.cpp -o rcpparma_hello_world.o
g++-4.6 -shared -o inlineExample.so rcpparma_hello_world.o -L/usr/local/lib/R/site-library/Rcpp/lib -lRcpp -Wl,-rpath,/usr/local/lib/R/site-library/Rcpp/lib -llapack -lblas -lgfortran -lm -lquadmath -L/usr/lib/R/lib -lR
installing to /usr/local/lib/R/site-library/inlineExample/libs
** R
Error in parse(outFile) : 3:21: unexpected '<'
2: structure(function (UmatrixR) 
3: .Primitive(".Call")(<
                      ^
ERROR: unable to collate and parse R files for package ‘inlineExample’
* removing ‘/usr/local/lib/R/site-library/inlineExample’
edd at max:/tmp$ 

That is is simply not supported. You have to subscribe your inline'd object
by hand.

Second, and as for the manual page leading to an error: we can reproduce that
via

  package.skeleton(name='pkgskelExample',list=c('plus.two.r'))

which is free of any Rcpp-isms.  So this appears to be "simply" a bug in R.

Dirk

-- 
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com  


More information about the Rcpp-devel mailing list