[英]How can I reinstall all R packages from the superuser to the user?
I'm using R in Ubuntu. 我在Ubuntu中使用R。 I've realised that I have packages installed in both
/usr/local/lib/R/site-library/
and /home/sparhawk/R/x86_64-pc-linux-gnu-library/3.0/
. 我意识到我已经在
/usr/local/lib/R/site-library/
和/home/sparhawk/R/x86_64-pc-linux-gnu-library/3.0/
。 I'd prefer them all in my user directory. 我希望它们都在我的用户目录中。
How can I move all the (non-base) packages to the user directory? 如何将所有(非基本)软件包移至用户目录? I'm happy to reinstall R and/or the packages if necessary.
如有必要,我很高兴重新安装R和/或软件包。
I've also tried sudo apt-get purge r-base
, but this didn't touch the root directory listed above. 我也尝试了
sudo apt-get purge r-base
,但这没有碰到上面列出的根目录。
Use the destdir option with install.packages to specify the location of the packages to be installed. 将destdir选项与install.packages一起使用可指定要安装的软件包的位置。
install.packages("RCpp,destdir="~/RPackages", CRAN="http://cran.r-project.org")
install.packages(“ RCpp,destdir =”〜/ RPackages“,CRAN =” http://cran.r-project.org“)
First I purged the Ubuntu package 首先,我清除了Ubuntu软件包
$ sudo apt-get purge r-recommended
$ sudo apt-get --purge autoremove
...
dpkg: warning: while removing r-base-core, directory '/usr/lib/R/library' not empty so not removed
As above, one directory was not removed, so 如上所述,未删除一个目录,因此
$ rm -r /usr/lib/R /tmp
The package directories at /usr/local/lib/R/site-library/
and ~/R/x86_64-pc-linux-gnu-library/
were still present, so I removed them. /usr/local/lib/R/site-library/
和~/R/x86_64-pc-linux-gnu-library/
中的软件包目录仍然存在,因此我删除了它们。
$ mv /usr/local/lib/R/ /tmp
$ mv ~/R/ /tmp/R-user
sudo apt-get install r-recommended
Run R from a user account (I used RStudio). 从用户帐户运行R(我使用RStudio)。 Install packages manually.
手动安装软件包。
At one point, I got the warning. 有一次,我得到了警告。
Warning message:
installed directory not writable, cannot update packages 'Matrix'
So rather than run R as superuser, I attempted to install another version in the user directories. 因此,我没有以超级用户身份运行R,而是尝试在用户目录中安装另一个版本。 I think I have both versions installed, but R seems to pick the newer version.
我想我已经安装了两个版本,但是R似乎选择了较新的版本。
> update.packages()
Matrix :
Version 1.0-14 installed in /usr/lib/R/library
Version 1.1-0 available at http://cran.rstudio.com
Update (y/N/c)? y
Warning in install.packages(update[instlib == l, "Package"], l, contriburl = contriburl, :
'lib = "/usr/lib/R/library"' is not writable
Would you like to use a personal library instead? (y/n) y
...
> update.packages()
Warning: package 'Matrix' in library '/usr/lib/R/library' will not be updated
> packageVersion('Matrix')
[1] ‘1.1.0’
However, despite R seemingly picking the latest version, I still get warning messages about being unable to upgrade packages. 但是,尽管R似乎选择了最新版本,但我仍然收到有关无法升级软件包的警告消息。
> biocLite("limma")
Warning message:
installed directory not writable, cannot update packages 'Matrix'
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.