5

I am having trouble running Rcpp on my PC in RStudio. Whenever I sourceCpp() a cpp file, even the Hello World file that comes with Rcpp::Rcpp.package.skeleton(), I get the warning

In normalizePath(path.expand(path), winslash, mustWork) :
  path[1]=".../anRpackage/src/../inst/include": The system cannot find the path specified 

I searched Stackoverflow and it looks like some people get this warning if they don't have Depends: Rcpp in the DESCRIPTION of their package, but I am just running sourceCpp() so the DESCRIPTION file shouldn't matter (I also changed my DESCRIPTION file). It is just a warning so the class and functions I wrote do appear in R, but RStudio frequently crashes after I use the functions in R a few times, which may or may not be related.

My session info:

R version 3.1.3 (2015-03-09)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 8 x64 (build 9200)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C                           LC_TIME=English_United States.1252    

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

other attached packages:
[1] Rcpp_0.12.1         RevoUtilsMath_7.4.1 RevoUtils_7.4.1     RevoMods_7.4.1      RevoScaleR_7.4.1    lattice_0.20-30     rpart_4.1-9        

loaded via a namespace (and not attached):
[1] codetools_0.2-10 foreach_1.4.2    grid_3.1.3       iterators_1.0.7  tools_3.1.3  

I suppose it is possible that Revolution R is the culprit here, but I have no way of knowing. I would appreciate help, because I don't want to ignore this warning, and it's obviously not ideal for RStudio to crash repeatedly.

Kind Regards

2
  • 1
    Start over, create a package either via Rcpp.package.skeleton() or the File -> New Project -> New Directory -> R Package -> Package w/Rcpp helper in RStudio. Build that package. Commented Nov 3, 2015 at 11:56
  • 2
    Thanks @DirkEddelBuettel, but that doesn't seem to have solved the problem. What I've done now is instead of sourceCpp() the file, I build and load the package. In this case instead of having my class loaded immediately into my environment, my module loads and I have to select the class from my module. When I do so my class works as expected, but I get the warning saying: in installClassMethod: method .objectPackage from class was not processed into a class method until being installed. Possible corruption of the methods in the class. I'm not sure what the problem is here. Kind Regards
    – Carl
    Commented Nov 3, 2015 at 19:19

1 Answer 1

8

This is still relevant today, so here's my discoveries.

Rcpp can generate interfaces to and from C++ and R. These are generated with the help of attributes specified in source-files.

From these attributes, the call to Rcpp::compileAttributes() produces the headers. Whilst at it, this also create the folder <package directory>/inst/include. If you have specified no attributes, anywhere, then compileAttributes() does not create these directories.

In order to get rid of this warning, create the <package directory>/inst/include.

For more on attributes, see Rcpp attributes vignette.

0

Not the answer you're looking for? Browse other questions tagged or ask your own question.