1

Currently if I try to call R directly from the command line I get this error:

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

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

In Windows does anyone have a way to easily call R so that it executes with one of the options automatically? Basically I want to avoid typing --no-save every time I start R (or every time one of my scripts starts R).

This is a helpful post for setting the PATH variable and setting up R, but I didn't see the answer there: R CMD on Windows 7 Error - "R" is not recognized as an internal or external command,

EDIT: Turns out this is an issue with mysys32. R works in the Windows terminal, it appears to call R --save.

Community
  • 1
  • 1
geneorama
  • 3,057
  • 4
  • 24
  • 33

1 Answers1

0

First, Git for Windows does not use msys32 for almost two years.

The current version is GNU bash, version 4.3.46(2)-release (x86_64-pc-msys)

Make sure to uncompress the self-extracting archive PortableGit-2.11.1-64-bit.7z.exe

With the latest Git bash session, a simple R.exe is enough:

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.

As mentioned, you can alias r to /c/prgs/R/R-3.3.1/bin/R.exe if you need to.

Community
  • 1
  • 1
VonC
  • 1,042,979
  • 435
  • 3,649
  • 4,283
  • By the way, I've never been sure how to refer to git bash, and I even posted a question about it for exactly these situations. That process was so frustrating that I swore off SO for about a year. I only used SO today because I figured the question was simple http://superuser.com/questions/1053633/what-is-git-bash-for-windows-anyway – geneorama Feb 17 '17 at 21:59
  • @geneorama no need for SuperUsers, I have documented that a long time ago here: http://stackoverflow.com/a/784743/6309, and http://stackoverflow.com/a/26826359/6309 – VonC Feb 17 '17 at 22:01
  • @geneorama also http://stackoverflow.com/a/17810334/6309 and more importantly: "**How are msys, msys2, and msysgit related to each other?**" (http://stackoverflow.com/a/35099458/6309) – VonC Feb 17 '17 at 22:04