tags:

views:

183

answers:

2

Hi,

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

+2  A: 

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
+5  A: 

You should probably look Rscript instead of redirection -- this would become

Rscript.exe C:\someScript.R

where you can add the usual options.

Dirk Eddelbuettel