我知道有很多关于这个问题的问题,但我已经尝试了所有方法,我认为我只是不明白在Windows中如何使用命令行。我有一个文件保存在桌面上的文件夹中,比如说:
C:\Users\abika_000\Desktop\R models\myfile.R
这里是我的 R/bin 或 Rscript/bin 目录:
C:\Program Files\R\R-3.1.0\bin
我希望能使用命令提示符来运行这段代码。我该怎么做?
我尝试了下面问题中给出的解决方案,但无论我做什么都会出现错误: 从命令行运行R脚本 我输入的内容是:
> R CMD BATCH C:\Users\abika_000\Desktop\R models\myfile.R
> Rscript C:\Users\abika_000\Desktop\R models\myfile.R
我得到的错误信息是:
'R' is not recognized as an internal or external command, operable program or batch file
'Rscript' is not recognized as an internal or external command, operable program or batch file
编辑:
感谢splendour和Phil的帮助。我最终通过输入以下内容来修复它:
> "C:\Program Files\R\R-3.1.0\bin\"R CMD BATCH "C:\Users\abika_000\Desktop\R models\myfile.R"
非常抱歉我的问题不够清晰。我不确定如何在尝试使用R CMD BATCH或Rscript时使用cmd提示符/目录。
R CMD BATCH \path\to\script\script.R
。您尝试过什么?看到了什么错误? - Phil