"vincent.deluard" <vincentdelua...@gmail.com> writes: > I am trying to automate the daily running of a simple R script from Windows > 7. >>From previous posts, I understand that this needs to be done with the task > scheduler.
That is correct. > I can schedule my laptop to automatically open R at a certain time, but not > to execute a script. For example you can use schtasks /create /tn "My R task" /sc DAILY /ST 03:00:00 /TR C:\path_to_your_batch_file.cmd to start task daily at 3am. > Secondary question: how do I save a list of R commands so that they get > executed once the file is open? I highly recommend to read a manual on Rscript and use it in your batch file instead of the "source"-ing mentioned below. > Right now, I save my code in a notepad doc and paste over in R, but there > has to be another way. Consider using some IDE. If not Emacs+ESS or Eclipse, then at least Tinn-R. > I have tried saving my code as .r file using the > editor and open the file with R later but this does not seem to execute the > code. You should "source" your file to "execute" it, i.e. source("path_to_my.R") -- Mikhail ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.