Installing Multiple Versions of R

Installing multiple versions of R

Yes, this is pretty easy as Josh Ulrich's comment already says.

People usually have this question regarding r-devel installation alongside the basic R you will get from your distro. I use a simple shell script to build / update R-devel, and two matching ones to run R-devel and Rscript-devel. I can't recall if I blogged about it, but folks seem to point to an this older post on the r-sig-debian list which contains it. Here is a nice post by Michael detailing the same process.

And by creating new subdirectories, you can add as many R version as you want. You should keep the local builds in /usr/local, though, and could create softlinks for the binaries in /usr/local/bin. The script R itself will have R_HOME_DIR hard-coded and "just work".

Fancier approaches involve virtualization, and on Linux your best bet is docker which I am playing with now, and which I hope to detail at some point for this very purpose of testing R packages against multiple compilers etc.

How do you use multiple versions of the same R package?

You could selectively alter the library path. For complete transparency, keep both out of your usual path and then do

 library(foo, lib.loc="~/dev/foo/v1")    ## loads v1

and

 library(foo, lib.loc="~/dev/foo/v2")    ## loads v2

The same works for install.packages(), of course. All these commands have a number of arguments, so the hooks you aim for may already be present. So don't look at changing R_HOME, rather look at help(install.packages) (assuming you install from source).

But AFAIK you cannot load the same package twice under the same name.

Install two versions of rtools

The problem was due to the fact that Microsoft R Client version 3.5.2, was installed in a path with space E:\Program Files\Microsoft\R Client, it was solved by installing it in a path without spaces E:\Microsoft\R-Client, such as suggested in: Message error 'C:/Program' not found with Rcpp



Related Topics



Leave a reply



Submit