我试图安装一个包:
install.packages(
'rJava',
repos = 'http://cran.us.r-project.org',
lib = './lib',
quiet = FALSE,
verbose = TRUE
)
上述命令位于由Rscript执行的脚本中。
输出
trying URL 'http://cran.us.r-project.org/src/contrib/rJava_0.9-8.tar.gz'
Content type 'application/x-gzip' length 656615 bytes (641 Kb)
opened URL
==================================================
downloaded 641 Kb
foundpkgs: rJava, /tmp/RtmpBRe4qd/downloaded_packages/rJava_0.9-8.tar.gz
files: /tmp/RtmpBRe4qd/downloaded_packages/rJava_0.9-8.tar.gz
1): succeeded '/usr/lib/R/bin/R CMD INSTALL -l '/home/vagrant/examples/lib' /tmp/RtmpBRe4qd/downloaded_packages/rJava_0.9-8.tar.gz'
The downloaded source packages are in
‘/tmp/RtmpBRe4qd/downloaded_packages’
但是,如果lib文件夹为空:
$ ls lib/
[empty]
为什么CMD INSTALL报告它没有成功?如果我自己手动运行CMD INSTALL,安装成功:
$ R CMD INSTALL -l '/home/vagrant/examples/BigR/lib' /tmp/RtmpBRe4qd/downloaded_packages/rJava_0.9-8.tar.gz
* installing *source* package ‘rJava’ ...
...
** testing if installed package can be loaded
* DONE (rJava)
此后,lib文件夹现在包含:
$ ls -l lib/
total 4
drwxrwxr-x 10 vagrant vagrant 4096 Mar 16 09:37 rJava
答案 0 :(得分:0)
我的解决方案是使用最新版本的R,因为我使用的是Ubuntu精确软件包管理器安装的旧版本。