Everything Duncan said, plus: A construction like this might do the job
run.at <- as.POSIXct('2015-02-26 13:05') while(TRUE) { if ( trunc(Sys.time(),'min') == run.at) source('whatever-it-is.r') Sys.sleep(60) } but I wouldn't count on it to be as reliable as cron (or Windows equivalent). -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 2/26/15, 11:20 AM, "Duncan Murdoch" <murdoch.dun...@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. > >Duncan Murdoch > >______________________________________________ >R-help@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. ______________________________________________ R-help@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.