[R] Automating an R function call
peter dalgaard
pdalgd at gmail.com
Fri Aug 12 21:41:28 CEST 2011
On Aug 12, 2011, at 21:26 , Duncan Murdoch wrote:
> On 12/08/2011 2:03 PM, RobertJK wrote:
>> Any way to run an R function every 5 minutes from the R terminal? Searched
>> around but couldn't find any answers. Thanks!!
>
> Yes, but not in the background:
>
> repeat {
> f()
> Sys.sleep(300)
> }
>
> If you want it run in the background, get your OS to run R to do it. (It's possible the tcltk package will give you access to some tcl way to set a background process; I don't know. Similarly, you could call out to C and start up another thread, etc., but R itself is single-threaded.)
>
For asynchronuos within-R possibilities check out tkafter in the tcltk package.
--
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
"Døden skal tape!" --- Nordahl Grieg
More information about the R-help
mailing list