How to run an R script in Powershell?

Run R script from Powershell

  • In old DOS script, I can run an R script with the following syntax: Rterm.exe --quiet --slave --vanilla < "C:\some_script.R" However, Powershell seems to have reserved "<" for future expansion. I am wondering if there is a direct way to run R script within another powershell script. Thanks

  • Answer:

    You should probably look Rscript instead of redirection -- this would become Rscript.exe C:\someScript.R where you can add the usual options.

defoo at Stack Overflow Visit the source

Was this solution helpful to you?

Other answers

Easiest way is probably to wrap it in a call to cmd.exe: cmd.exe /C "Rterm.exe --quiet --slave --vanilla < `"C:\some_script.R`""

James Kolpack

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.