使用默认选项在命令行中调用R.

时间:2017-02-17 19:44:51

标签: r windows git-bash

目前,如果我尝试直接从命令行调用R,我会收到此错误:

$ R
Fatal error: you must specify '--save', '--no-save' or '--vanilla'

$ which R
/c/R/R-3.3.1/bin/R

在Windows中,是否有人可以轻松调用R以便自动执行其中一个选项?基本上我想避免每次启动R(或每次我的一个脚本启动R)时都键入--no-save

这是设置PATH变量和设置R的有用帖子,但我没有在那里看到答案:R CMD on Windows 7 Error - "R" is not recognized as an internal or external command,

编辑:原来这是mysys32的问题。 R在Windows终端中有效,似乎可以调用R --save

1 个答案:

答案 0 :(得分:0)

首先,Git for Windows执行not use msys32 for almost two years

当前版本为GNU bash, version 4.3.46(2)-release (x86_64-pc-msys)

确保解压缩自解压存档PortableGit-2.11.1-64-bit.7z.exe

使用最新的Git bash会话,一个简单的R.exe就足够了:

vonc@bigvonc MINGW64 /c/prgs/R/R-3.3.1/bin
$ ./R.exe

R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

如上所述,如果需要,您可以将r设为/c/prgs/R/R-3.3.1/bin/R.exe