简体   繁体   English

如何将所有R软件包从超级用户重新安装到用户?

[英]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“)

Uninstall R and packages 卸载R和软件包

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

Reinstall R and packages 重新安装R和软件包

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.

相关问题 如何重新安装损坏的python软件包 - How to reinstall broken packages of python 如何安装适用于python 3的所有python 2软件包? - How can I install all my python 2 packages for python 3? Ubuntu Desktop 是否附带 C 包和编译器? 如何以及在哪里可以检查所有可用的 C 接头? - Is Ubuntu Desktop shipped with C packages and compilers ? How and where can I check all the available C headers? 如何向我的本地用户授予所有postgres权限? - How can I grant all postgres permissions to my local user? 如果我在centos服务器中删除/ etc / nginx,请重新安装nginx如何再次重新安装它我在centos和nginx中是新用户 - reinstall nginx if i delete /etc/nginx in centos server how to reinstall it again i am new in centos and nginx 如何指定用户可以使用visudo安装的rpm软件包? - How to specify the rpm packages that a user can install using visudo? 如何从没有依赖项的特定仓库中删除所有包 - How to remove all packages from specific repo without dependencies 无法在centos上卸载并重新安装R - unable to uninstall and reinstall R on centos Debian:列出所有用户安装的软件包? - Debian: Listing all user-installed packages? 彻底取消安装后如何重新安装npm? - How do I reinstall npm after stupidly unistall it?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM