简体   繁体   中英

How do I ensure R / Rcpp code is reproducible (“distributable”)?

I've written some R code for a dissertation, relying on some external packages (eg, plyr and reshape ) and writing a couple relatively simple inline C++ functions using inline and RcppArmadillo .

I would like to ensure it can be performed "as is" on computers others than my own (Win64), for research reproducibility purposes.

My question: suppose I included code for installing the required packages, would the RcppArmadillo (and Rcpp and inline ) packages be sufficient to be able to compile the functions written in RcppArmadillo , or would the end user need to change system paths for compilation on his Windows machine? If not, is it possible/recommended to saved the compiled functions from my end and included in the R code I'm shipping?

Also, in the unlikely case that the code should be run some time later (say, a couple of years), is it suffient to include a full R installation with the relevant packages in their current version to make the code "future-proof"?

I hope the question is clear.

I think you mean your code to be "distributable" and "executable by someone else" which is a looser requirement. Being "reproducible" implies that the previous question is a true, and adds the restriction that the results are identical (up to the an epsilon of your choice).

And the usual answer for 'how can I let others run my R code' is to create a package.

For Rcpp-related code, we have an entire vignette devoted to building your own package with your Rcpp-using cod. The vignette is called 'Rcpp-package'.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM