Hey,
 Also, if your function varies in time (less than 5 minutes) then you could
use
total.time.difference=system.time(some.function)[1)]
# (for user time)  and you could plug this into your Sys.sleep() (which
accepts decimal seconds) if you can #accept an error on the order of
hundredths of seconds (and don't need to run another process in said
console)
            Ken



On Fri, Aug 12, 2011 at 3:41 PM, peter dalgaard <pdalgd@gmail.com> wrote:

>
> 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@cbs.dk  Priv: PDalgd@gmail.com
> "Døden skal tape!" --- Nordahl Grieg
>
> ______________________________________________
> 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.
>

	[[alternative HTML version deleted]]

