Rscript:找不到命令 [英] Rscript: command not found

查看:1335
本文介绍了Rscript:找不到命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在R上工作了一段时间,我一直在Rstudio上工作,我刚才尝试在终端上运行Rscript命令(我有一个Mac ..),但出现此错误-

I'm working with R for a while, and I always worked with Rstudio, I tried just now to run a Rscript command in terminal (I have a mac..) and I got this error-

>Rscript script.R
 -bash: Rscript: command not found

当我尝试在终端中打开R时,出现相同的错误-

when I tried to open R in the terminal I go the same error-

>R
-bash: R: command not found

我可以使用Rstudio和R应用程序运行R代码,但是我知道有一种方法可以运行R抛出终端. 在计算机上安装R时是否错过了某些东西?我需要在路径中添加R吗?

I can run R code with the Rstudio and the R application, but I know there is a way to run R throw the terminal. Did I miss something when I installed R on my computer? do I need to add R to my PATH?

提前谢谢!

推荐答案

通过Windows command prompt

  1. 在环境变量中为Rscript.exe设置PATH变量.可以在Rbin文件夹中找到Rscript.exe.在Windows命令提示符下,将Rscript.exe的路径设置为使用Rscript命令.若要检查Rscript.exe是否已在环境上设置,请在命令提示符下键入Rscript.将会出现以下消息.
  1. Set the PATH variable for Rscript.exein the environment variables. Rscript.exe can be found inside bin folder of R. Set the path for Rscript.exe to use Rscript command in Windows command prompt. To check if Rscript.exe has been set environmentally or not, type Rscript in command prompt. The follwoing message should come.

  1. 转到命令提示符,设置.R文件所在的路径.
  2. 运行以下命令:abcd.R出现在Documents文件夹下.所以我设置了路径然后运行Rscript abcd.R
  1. Go to Command Prompt, set the path where your .R file is there.
  2. Run the following command: Here abcd.R is present under Documents folder. So I set path and then run Rscript abcd.R

这篇关于Rscript:找不到命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆