I wrote a small R script that calaulate some calculation and make a csv file (by using write.csv) and it's work fine when running the script. Now I want this script run from .bat file, what i have to wrote in the .bat file?
Asked
Active
Viewed 4,200 times
0
-
https://stackoverflow.com/a/5720968/5316882 – anotherfred Nov 09 '17 at 22:41
1 Answers
0
Use Rscript
which is in the same folder as R.
Usage: Rscript myfilename.R

anotherfred
- 1,330
- 19
- 25
-
My batch file is- "R CMD BATCH "C:\Program Files\R\R-2.13.1\bin\R.exe "C:\RStudio\DailyRets\Dailyrets.r" sowhat i have to change? – yudyud Nov 10 '17 at 05:10
-
`"C:\Program Files\R\R-2.13.1\bin\Rscript.exe" "C:\RStudio\DailyRets\Dailyrets.r" ` or add Rscript to your `path` and use `Rscript "C:\RStudio\DailyRets\Dailyrets.r" ` https://www.howtogeek.com/118594/how-to-edit-your-system-path-for-easy-command-line-access/ – anotherfred Nov 10 '17 at 06:40
-
Hi, when running a batch file contain this- "C:\Program Files\R\R-2.13.1\bin\Rscript.exe" "C:\RStudio\DailyRets\Dailyrets.r" , thereis a message - the system cannot find. I'm confused, what i have to change now? – yudyud Nov 10 '17 at 09:21