This is similar to this question and answer , except specialized to R packages. Since R uses its own custom build process, what is the correct way to force a rebuild using Rcpp?
(For reasons that I won't go into here, all of my C++ code is located outside /pkg/src, and is called via a simple wrapper function that never changes. For this reason, when the important code changes, R thinks nothing has changed and declares the dreaded make: Nothing to be done for 'all'.
)
Regarding
what is the correct way to force a rebuild using Rcpp
the obvious answer is to rebuild from source
R CMD INSTALL sourceTarballOfPackage_0.1.2.tar.gz
The question then becomes where to get the source: CRAN, GitHub, GitLab, BitBucket, ... but we have helpers for that.
If your code is internal, then you just need to rebuild the wrapper calling it, and that is still in src/
in the package. That is no different then another R(cpp) package linking against external resources.
The simplest solution is to add the flag --preclean
to R CMD INSTALL
. In Rstudio, this flag can be added under Project Options -> Build Tools -> Build and reload - R CMD INSTALL additonal options.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.