[R] Schedule R function/Code to run at specific time

peter dalgaard pdalgd at gmail.com
Thu Feb 26 22:19:48 CET 2015


> On 26 Feb 2015, at 20:20 , Duncan Murdoch <murdoch.duncan at gmail.com> wrote:
> 
> On 26/02/2015 2:08 PM, Doran, Harold wrote:
>> Is there functionality within R proper, without having to revert to the OS, allowing a function or a portion of an R script to be run at a defined time? My google searches haven't provided much other than one at the link below which relies on an OS.
> 
> If you want it to start 1000 seconds from now, use Sys.sleep(1000) as your first statement.  You'll have a process sitting there using no CPU (but perhaps lots of virtual memory) until the sleeping is done.  Using cron is better.
> 

There are also some asynchronous possibilities using tcltk:

tcl("after", 10000, quote(print("boo")))

Peter D.

> Duncan Murdoch
> 
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com



More information about the R-help mailing list