问题描述
我在Windows 8.1上运行带有R 3.0.1的Rstudio 0.97.我通过Rstudio安装了很多软件包,它们都转到"\ R \ R-3.0.1 \ library".现在,我安装了R 3.1.0,并将Rstudio设置为使用新版本的R.但是随后,我发现Rstudio都无法访问这些软件包.
I am running Rstudio 0.97 with R 3.0.1 on Windows 8.1. I installed a lot of packages through Rstudio and they all went to "\R\R-3.0.1\library". Now I installed R 3.1.0 and set Rstudio to use the new version of R. But then I found the packages are all inaccessible from Rstudio.
如何将软件包制作在共享文件夹中,以便PC上不同版本的R都可以使用它们?
How to make the packages in a shared folder so that the different versions of R on my PC can all use them?
我试图使用.libPaths("XXXX package sharefolder")设置一个共享文件夹来存储和安装新软件包,它在会话中有效,但是当我重新启动Rstudio时,路径会重置.没用.
I tried to use .libPaths("XXXX package sharefolder") to set a sharefolder to storing and installing new packages, it works in a session but when I restart Rstudio, the path is reset. Didn't work.
推荐答案
首先,如果需要,请mkdir ~/whatever-you-want
.
第二,将R_LIBS_USER="~/whatever-you-want"
添加到'~/.Renviron'
.
因此,如果您要重复使用\R\R-3.0.1\library
,请在'~/.Renviron'
中添加R_LIBS_USER="\R\R-3.0.1\library"
.如果使用Windows,请将.Renviron
放在C:\Users\<user-name>\
中.
So, if you want to reuse \R\R-3.0.1\library
as you mentioned, add R_LIBS_USER="\R\R-3.0.1\library"
to your '~/.Renviron'
. If you are using Windows, put the .Renviron
in C:\Users\<user-name>\
.
希望有帮助.
这篇关于如何使用自定义目录位置来安装R软件包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!