tags:

views:

222

answers:

1

I'm struggling with the different R executables. What exactly is the difference between R.exe (with or without CMD BATCH), Rcmd.exe, Rscript.exe and Rterm.exe when running command line in a batch file?

And what, for example, is the difference between

"C:\Program Files\R\R-2.10.1\bin\R.exe" --no-environ --no-save < "c:\temp\R\test.R" > "c:\temp\R\out.txt" 2>&1

and

"C:\Program Files\R\R-2.10.1\bin\R.exe" CMD BATCH --no-environ --no-save "c:\temp\R\test.R" "c:\temp\R\out.txt"

No difference in the output.

I cannot find anything about Rcmd.exe and Rscript.exe in the 3079 pages R reference manual.

(I'm using Windows)

+8  A: 

Caveat: I work much more on Linux then Windows but

  • Rcmd.exe is a historical left-over as back in the day, you could not do R CMD something on Windows but needed the special executable Rcmd.exe something. That is no longer the case, yet it is provided for backwards compatibility.
  • Rterm.exe is also a holdover from the days when Rcmd.exe was used. Can be ignored these days.
  • R CMD BATCH is a clutch that was needed in the days before littler and Rscript.exe, and similarly lingering from old docs and habits..
  • Rscript.exe is your friend for batch scripts; use it.
  • For everything else, there's R.exe.

Other than that, as Marek hinted, the reference manual is the wrong one among the six available manuals. Try the Introduction to R and the Installation and Admin manuals both of which have specific appendices for Windows.

Edit Added forgotten Rterm.exe entry above.

Dirk Eddelbuettel
Thanks. So I can forget Rcmd.exe and R CMD BATCH?
waanders
I just want to run a R script with command line agurments in a Windows (shell) batchfile. As I understand it correctly R.exe is enough for me.
waanders
What about Rterm.exe?
waanders
R Introduction states "Within a terminal window (...) invoking by R.exe or more directly by Rterm.exe". So for everything else Rterm?
Marek
Sorry, forgot about `Rterm.exe`. Also a leftover.
Dirk Eddelbuettel
Thank you both!
waanders
Remarkable: When I start R.exe with a R script by using a batchfile I see a R.exe process AND a Rterm.exe process running in the Windows Task Manager
waanders
There is an important difference between R.exe and Rterm.exe - Rterm.exe is compiled with /LARGEADDRESSAWARE and can allocate 4 GB RAM when run under Windows 64 bit, unlike R.exe (we're talking about 32 bit R running under 64 bit Windows). Why would the R people do this only for Rterm.exe and not for R.exe, if Rterm.exe is obsolete?
Adal