[英]How can I reinstall all R packages from the superuser to the user?
我在Ubuntu中使用R。 我意識到我已經在/usr/local/lib/R/site-library/
和/home/sparhawk/R/x86_64-pc-linux-gnu-library/3.0/
。 我希望它們都在我的用戶目錄中。
如何將所有(非基本)軟件包移至用戶目錄? 如有必要,我很高興重新安裝R和/或軟件包。
我也嘗試了sudo apt-get purge r-base
,但這沒有碰到上面列出的根目錄。
將destdir選項與install.packages一起使用可指定要安裝的軟件包的位置。
install.packages(“ RCpp,destdir =”〜/ RPackages“,CRAN =” http://cran.r-project.org“)
首先,我清除了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
如上所述,未刪除一個目錄,因此
$ rm -r /usr/lib/R /tmp
/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
從用戶帳戶運行R(我使用RStudio)。 手動安裝軟件包。
有一次,我得到了警告。
Warning message:
installed directory not writable, cannot update packages 'Matrix'
因此,我沒有以超級用戶身份運行R,而是嘗試在用戶目錄中安裝另一個版本。 我想我已經安裝了兩個版本,但是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’
但是,盡管R似乎選擇了最新版本,但我仍然收到有關無法升級軟件包的警告消息。
> biocLite("limma")
Warning message:
installed directory not writable, cannot update packages 'Matrix'
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.