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.
To run an R command, put the cursor on the line of the command and then click the Run button at the top of the file window. Or just press CTRL-Enter.
Running R scripts from the command line can be a powerful way to: Automate your R scripts. Integrate R into production. Call R through other tools or systems.
Starting R If R has been installed properly, simply entering R on the command line of a terminal should start the program. In Windows, the program is typically specified as the action performed when clicking on an icon. You can also use this method on a *NIX system that has a window manager such as KDE.
You should probably look Rscript
instead of redirection -- this would become
Rscript.exe C:\someScript.R
where you can add the usual options.
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`""
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With