Reputation: 5297
In batch 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.
Upvotes: 15
Views: 30254
Reputation: 368201
You should probably look Rscript
instead of redirection -- this would become
Rscript.exe C:\someScript.R
where you can add the usual options.
Upvotes: 25
Reputation: 9382
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`""
Upvotes: 4