在Ubuntu 12.04上下载install.packages R软件包,但无法安装软件包。
在Ubuntu 12.04上下载install.packages R软件包,但无法安装软件包。
我感到困惑。我已经做了这个过程十几次,从来没有遇到过这个问题。
我为Ubuntu安装了最新版本的R
我进入R,一点问题也没有,它给我最新版本,我可以加载本地包。
但是当我尝试安装新的包时,它们会下载,但我什么也得不到。例如,如果我安装ggplot2:
> install.packages("ggplot2") Installing package into ‘/usr/local/lib/R/site-library’ (as ‘lib’ is unspecified) also installing the dependencies ‘colorspace’, ‘stringr’, ‘RColorBrewer’, ‘dichromat’, ‘munsell’, ‘labeling’, ‘plyr’, ‘digest’, ‘gtable’, ‘reshape2’, ‘scales’, ‘proto’ trying URL 'http://rweb.quant.ku.edu/cran/src/contrib/colorspace_1.2-4.tar.gz' Content type 'application/x-gzip' length 242791 bytes (237 Kb) opened URL ================================================== downloaded 237 Kb trying URL 'http://rweb.quant.ku.edu/cran/src/contrib/stringr_0.6.2.tar.gz' Content type 'application/x-gzip' length 20636 bytes (20 Kb) opened URL ================================================== downloaded 20 Kb [snip ... ] trying URL 'http://rweb.quant.ku.edu/cran/src/contrib/ggplot2_0.9.3.1.tar.gz' Content type 'application/x-gzip' length 2330942 bytes (2.2 Mb) opened URL ================================================== downloaded 2.2 Mb The downloaded source packages are in ‘/tmp/RtmpoPUAFL/downloaded_packages’ > library(ggplot2) Error in library(ggplot2) : there is no package called ‘ggplot2’
我已经完全清理了文件多次,但没有任何运气。
我以root用户登录。
我感觉我错过了一些明显的东西吗?我不知道——我在Ubuntu、Mac、Windows和Debian上做了同样的事情十几次。帮帮我?
admin 更改状态以发布 2023年5月22日
看最后一行:
The downloaded source packages are in ‘/tmp/RtmpoPUAFL/downloaded_packages’
你必须进入目录/tmp/RtmpoPUAFL/downloaded_packages
(cd ...)然后按上面指出的顺序手动安装它们。所以
R CMD INSTALL colorspace_1.2-4.tar.gz R CMD INSTALL stringr_0.6.2.tar.gz R CMD INSTALL ggplot2_0.9.3.1.tar.gz
然后现在尝试library(ggplot2)
它应该可以工作了
我不知道为什么有时你必须这样做...如果有人知道我也很乐意学习。