[R] How to Run R Programs in a Scheduled Way

Tony Breyal tony.breyal at googlemail.com
Thu Jan 22 11:35:44 CET 2009


Hi Thorsten, the way i do this (on Windows Vista Ultimate, SP1) is to
create a batch file and then have windows task scheduler call it at a
specific time. For example, to create my batch file i open up Notepad
and type the following single line into it:


"C:\Program Files\R\R-2.8.1\bin\R.exe" CMD BATCH --vanilla --slave "\
\PFO-SBS001\Redirected\tonyb\Desktop\myScript.R"


so this is basically: "[location of R.exe]" CMD BATCH --vanilla --
slave  "[location of your R script file]"

I then save this Notepad text file, and change the extension from
'.txt' to '.bat'. If you double click on this .bat file, it will run
your script.

All you have to do now is have scheduler point to your new .bat
file  :-)

HTH,
Tony Breyal

P.S. Be careful with windows scheduler (at least in Vista) if you want
the same script to run several times a day (e.g. setting a daily
trigger starting at 0900 and repeating every 2 hours for a duration of
12 hours). Instead of stopping when expected, it will just keep going
every 2 hours regardless of the duration you set (the only way around
this that i found was to programme in time constraints into my r
script itself, such as only running the script if a condition like
9<=current.hour & current.hour<=21 are met.)

On 22 Jan, 09:10, Thorsten Muehge <MUE... at de.ibm.com> wrote:
> Hello R Experts,
> does anyone know how to run R programs automatically using the window
> scheduler?
>
> I want to run some R programs automatically and make the results available
> via web.
>
> Mit freundlichen Grüßen / Best Regards / С наилучшими Ð¿Ð¾Ð¶ÐµÐ»Ð°Ð½Ð¸Ñ Ð¼Ð¸ /
> üdvözlettel
> Thorsten
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-h... at r-project.org mailing listhttps://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list