Best practices in isolating different package environment

I searched the similar questions, but I could not find an answer. I was wondering how you manage environments in developing several packages.
I was thinking about a conda env, but it seems it does not play well with Rcpp and macOS. I would be grateful if you could share your package development experience based on working on several packages on a single macOS system.

Have you seen the renv package?

2 Likes

Yes, I am reading about Docker and renv. Most of the documents and discussions are based on having an environment for reproducible research. I was interested in knowing standard practices in maintaining and developing several R packages with different R versions on one system.

Why do you want to have different R versions for the different R packages? You could use continuous integration to check your packages on different R versions (and operating system), see for instance actions/examples at v2 · r-lib/actions · GitHub for GitHub Actions workflows.

To have several R versions on your computer see rig by @Gabor.

1 Like

Thanks, @maelle , for your answer. I really appreciate @Gabor 's contribution to the open-source community.
Some of our users use the package on old servers with old R (mostly old national HPC's) and complain about reproducibility. As far as I researched so far, it seems docker + renv is a better option (for my test). Just one more question, is it a good practice to have several lockfiles in one project? For example:
A project works fine with R:3.6 and xgboost: 0.0.8.0 (not sure if it is a real version, just an example). The project also works fine with R:4.0.5 and xgboost 1.5.1.0. But its dependencies may need a different version of packages.
We can take care of R builds with different docker images and map renv's global cache to them. So when I want to test the package with R3.6, I can spin the 3.6 docker image, then inside the container, I can restore it based on the 3.6 lock file. Likewise, if I want to test it for R:4.0.5 inside the R:4.0.5 container, I can restore 4.0.5 lockfile.
Does it make sense? (tagging @kevinushey )

This topic was automatically closed after 45 days. New replies are no longer allowed.


If you have a query related to it or one of the replies, start a new topic and refer back with a link.