R.Exe, Rcmd.Exe, Rscript.Exe and Rterm.Exe: What's the Difference

R.exe, Rcmd.exe, Rscript.exe and Rterm.exe: what's the difference?

Caveat: I work much more on Linux than Windows:

  • 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 crutch 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.

R platform failed to start in Windows 10 when inside directory containing white spaces

In the end, I found a plausible solution by myself.
I realized that every time the R.exe is executed in a directory without spaces, the execution is automatically redirected to Rterm.exe. I don't know if they fixed the bug specifically to Rterm.exe in the last version, but this suggests that the Rterm executable is the responsible for opening the R console, and when I tried to execute it directly through a spaces-containing directory, it worked fine (at least in the last R version).

So, in summary, if someone else had this problem, just run Rterm.exe directly.

This resolution is useful enough for those who just depend on R portability, although the Rscript.exe and R.exe still are not working in these conditions. Rscript.exe is useful to execute scripts directly without the need to manually start a new session in a new window, and R.exe redirects to Rterm.exe based on your system, if it is 32-bit or 64-bit (at least as I observed).

Anyway, I already informed CRAN project about this bug, and I hope they check it and fix the issue in the next version. If someone else found an alternative solution, feel free to comment.

Why does running shiny start two Rscript processes on windows when launching from cmd line?

This is a general thing with the R scripting command-line utilities (Rscript.exe, R.exe, Rcmd.exe) and not specific to Shiny. All of these actually call Rterm.exe underneath to run the actual program in a separate process.

Try Rscript.exe with --verbose and you'll see what I mean:

> Rscript --verbose script.R
running
'C:\PROGRA~1\R\R-34~1.0\bin\x64\Rterm.exe --slave --no-restore --file=script.R'

You can try out the other tools and see how they behave.

For more info, check out the source code

  • https://github.com/wch/r-source/blob/trunk/src/gnuwin32/front-ends
  • https://github.com/wch/r-source/blob/trunk/src/unix/Rscript.c

This question has some good info as well

  • R.exe, Rcmd.exe, Rscript.exe and Rterm.exe: what's the difference?

Running an R script from command line (to execute from python)

You probably already have R, since you can already run your script.

All you have to do is find its binaries (the Rscript.exe file).

Then open windows command line ([cmd] + [R] > type in : "cmd" > [enter])

Enter the full path to R.exe, followed by the full path to your script.



Related Topics



Leave a reply



Submit