I played with the setup of the R package, the purpose of which is to use Rcpp in RStudio, but I'm struggling to get things to work correctly with Rcpp attributes.
My understanding of how this works is pretty slight, but my understanding is this:
- In C ++ source files, you can add Rcpp attributes, for example, the tag
// [[Rcpp::export]] marks the C ++ function for export, which makes it accessible to R. - When you create the package,
Rcpp then generates the corresponding C ++ code in the RcppExports.cpp file and the wrappers in the R source file RcppExports.R .
This does not work properly (as I expect) when I create my package. Roxygen does not play well with this when creating the NAMESPACE file (so I disabled this). The // [[Rcpp::export]] tag apparently just marks a function for export to R, and not also for marking a function for export to the package namespace.
More importantly, the attribute tag Rcpp // [[Rcpp::depends()]] is not processed correctly. If I copy the code here to a new source file and rebuild my package, gcc throws errors in the RcppExports.cpp file, saying that the BigMatrix identifier is not declared, which indicates that the tage attribute // [[Rcpp::depends(bigmemory)]] not handled correctly.
Since several things do not work the way I expected, what I miss in my understanding of Rcpp attribute tags?
source share