I'm using RcppParallel
in my own R package.
I know that I need to add Imports: RcppParallel
to the DESCRIPTION
file and importFrom(RcppParallel, RcppParallelLibs)
to the NAMESPACE
file.
My current workflow to compile my R package is:
- run
Rcpp::compileAttributes()
- run
devtools::document()
- manually add
importFrom(RcppParallel, RcppParallelLibs)
to theNAMESPACE
file - run
devtools::install("MyPackage",quick = T,upgrade="never")
My question is what changes should I make to my R package, so that I can skip the manual step 3? I already add Imports: RcppParallel
to the DESCRIPTION
file and why does importFrom(RcppParallel, RcppParallelLibs)
not show up in the NAMESPACE
file after step 2?
In one of your C++ source files add this to an existing entry
When you run
Rcpp::compileAttributes()
this gets carried over to an R file where theroxygen2
package, when running in 'full mode' also rewritingNAMESPACE
will add the entry.