Adding R dependencies to your project

 

If you are working in R, an alternative to using Domino environments is to install packages into your project itself, so that the package installations persist between runs of your project. While this well be less performant than using a compute environment, it's easy to implement while developing projects. To do so, you should install packages to a subfolder inside your Domino project and tell R to look in that folder when it loads packages. E.g.,

dir.create("rlibs")
.libPaths("rlibs")
install.packages("some.package", dependencies=TRUE, repos='http://cran.us.r-project.org')

Then, in the scripts that you want to normally run (e.g. main.R), tell R to look in your rLibs directory if it can't find a package in the standard location, by using this command:

.libPaths(c(.libPaths(), "~/userLibrary"))

This way the packages will be loaded from the project dir without the need to install on every run.

As always, if this isn't sufficient or you need software that cannot be installed this way, please ask us

Was this article helpful?
0 out of 0 found this helpful