安装多个版本的R [英] Installing multiple versions of R
问题描述
当我在学校时,系统管理员安装了多个R版本.在调查此错误的同时,我遇到了R-3.1.0的错误,需要重新安装R的某些旧版本进行开发,但是我看不到任何有关如何在R上具有多个并发版本的文档.相同的系统ti应该看起来像
When I was in school the system administrator had multiple versions of R installed. I'm running into a bug with R-3.1.0 and need to install reinstall some past versions of R for development while this bug is investigated, but I don't see any documentation about how to have multiple concurrent versions of R on the same system ti should look something like
$ ls -l /usr/lib | grep R-
lrwxrwxrwx 1 root root 8 Jun 3 09:41 R -> R-3.1.0/
drwxr-xr-x 9 root root 4096 May 15 11:56 R-3.1.0
drwxr-xr-x 9 root root 4096 May 15 11:56 R-3.0.3
$ ls -l /usr/bin | grep R-
lrwxr-xr-x 1 root root 8 Jun 3 09:41 R -> R-3.1.0
-rwxr-xr-x 9 root root 4096 May 15 11:56 R-3.1.0
-rwxr-xr-x 9 root root 4096 May 15 11:56 R-3.0.3
I see no documentation about how to achieve this either in the R Installation and Administration guide or in the configure --help
. I'm running a Gentoo system and the ebuild removes or overwrites the previous version of R on install, so I'll likely be installing from source.
推荐答案
是的,正如乔希·乌尔里希(Josh Ulrich)的评论已经说过的那样,这很容易.
Yes, this is pretty easy as Josh Ulrich's comment already says.
人们通常会遇到有关r-devel安装以及从发行版中获得的基本R的问题.我使用一个简单的shell脚本来构建/更新R-devel,并使用两个匹配的脚本来运行R-devel和Rscript-devel.我记不记得我是否写过博客,但是人们似乎指向包含它的r-sig-debian列表上的这一较早的帖子.
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.
通过创建新的子目录,您可以根据需要添加任意多个R版本.但是,您应该将本地版本保留在/usr/local
中,并且可以在/usr/local/bin
中为二进制文件创建软链接.脚本 R
本身将具有 R_HOME_DIR
硬编码并正常工作".
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".
更先进的方法涉及虚拟化,在Linux上,您最好的选择是 docker ,我现在正在使用它,以及我希望为此目的针对多个编译器等测试R包的细节.
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.
这篇关于安装多个版本的R的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!