I would like to invoke R script by using a .bat file. For testing, I saved an R file on the desktop in the name print_test.R The code in this file is:
p<-500
write.csv(p,"print.csv")
I wrote the .bat file :
@echo off
R CMD BATCH C:\Users\User\Desktop\print_test.R
UPDATE: After adding pause to the .bat file I got the following text:
"'R' is not recognized as an internal or external command,
operable program or batch file.
Press any key to continue . . ."
When I click on the bat file (also saved on the desktop) there is a blink of the CMD window but the print.csv file is not created.What is wrong?