批量执行R脚本 [英] batch execute R script
问题描述
我无法从Windows命令行获取脚本.
I am unable to source a script from the windows command line.
输入以下命令: "C:\ Program Files \ RStudio \ bin \ rstudio.exe" CMD BATCH --vanilla --slave"E:\ myfile.R"
Entering the following command: "C:\Program Files\RStudio\bin\rstudio.exe" CMD BATCH --vanilla --slave "E:\myfile.R"
打开Rstudio和有问题的脚本,但未提供源代码.文档说明中,您可以指定一个输出文件,但我只想执行脚本.有什么建议吗?
Opens Rstudio and the script in question, but does not source. Documentation notes you may specify an output file but I just want the script to execute. Any suggestions?
推荐答案
Agstudy的答案就是您所需要的,但作为参考,我只使用了两行:
Agstudy's answer is all you need but as reference to others I only used two lines:
PATH C:\ Program Files \ R \ R-3.1.0 \ bin;%path%
Rscript"E:\ Dir With Spaces \ myfile.R"
PATH C:\Program Files\R\R-3.1.0\bin;%path%
Rscript "E:\Dir With Spaces\myfile.R"
请注意,路径指向R而不是Rstudio.第2行中的引号涉及Dir With Spaces.
Note the path points to R and not Rstudio. The quotes in line 2 deal with Dir With Spaces.
这篇关于批量执行R脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!