ubuntu 上的 Rscript
我可以从哪里安装 Rscript?我需要使用 exec 从 php 文件运行 R 脚本。不过我需要先安装 Rscript。
Where can I install Rscript from? I need to run an R script from a php file using exec. However I need to install Rscript first.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
R 的主包名为
r-base
。有关脚本和命令行前端,请参阅littler
(或r-cran-littler
中xenial (16.04LTS) 及更高版本):The main package for R is called
r-base
. For the scripting and command-line front-end seelittler
(orr-cran-littler
in xenial (16.04LTS) and beyond):搜索 ubuntu 存储库。您检查过
littler
包吗?Search the ubuntu repositories. Have you checked the
littler
package?到目前为止发布的答案通常很有用,但它们并没有直接回答问题。我最近有同样的问题,发现 Ubuntu 没有 rscript 二进制文件。 r 二进制文件本身用于以批处理模式执行脚本,而不是我在 OS X 中使用的单独的 rscript 二进制文件。
看来您可以从其他来源获取 rscript 二进制文件(请参阅 http://craig-russell.co.uk/2012/05/08/install-r-on-ubuntu.html#.UwKWzkJdW2Q ),但我不确定当从命令行简单运行“r script.r”就可以正常工作时,为什么您需要它。
The answers posted so far are generally useful, but they don't directly answer the question. I recently had the same question and discovered there is no rscript binary for Ubuntu. The r binary itself is used to execute scripts in batch mode as opposed to the separate rscript binary that I was using in OS X.
It appears you may be able to get an rscript binary from other sources (see http://craig-russell.co.uk/2012/05/08/install-r-on-ubuntu.html#.UwKWzkJdW2Q for example), but I'm not sure why you would need that when simple running "r script.r" from the command line works just fine.
我尝试在全新的 ubuntu 安装(16.04.2 LTS)中运行
Rscript
并得到:因此,很自然地,我运行了
sudo apt install r-base-core
。安装花了几分钟。
后来,我需要安装一个 R 包,并意识到我需要一个 R shell。运行
r
返回:我再次遵循,这次速度相当快。
我不知道这些是否是正确的步骤(或者为什么它们会是错误的),但这就是系统引导我做的。
I tried running
Rscript
in a fresh ubuntu installation (16.04.2 LTS) and got:so, naturally, i ran
sudo apt install r-base-core
.installation took a couple of minutes.
Later, i needed to install an R package, and realized i needed an R shell for that. running
r
returned:Again, i followed, this time it was quite faster.
I don't know if these are the correct steps to take (or why they would be wrong), but it's what the system led me to do.