[R] Running R at a specific time - alternative to Sys.sleep() ?

Tony Breyal tony.breyal at googlemail.com
Tue Oct 21 18:38:28 CEST 2008


Thank you kindly Jim, that works great for me!

For anyone who does a search on this topic and finds this post, the
two web pages I used to further investigate Jim's suggestion were the
following (i did not know what a batch file was, or that you could use
windows task scheduler on them):

task scheduler - http://www.iopus.com/guides/winscheduler.htm
batch files - http://www.statmethods.net/interface/batch.html

I was able to write the batch file as a text document, and then after
saving it, changed the extension for '.txt' to '.bat'

Cheers,
Tony Breyal

On 13 Oct, 19:35, "jim holtman" <jholt... at gmail.com> wrote:
> Use the task scheduler in Windows and have a batch files executed.
>
> On Mon, Oct 13, 2008 at 11:44 AM, TonyBreyal
>
>
>
> <tony.bre... at googlemail.com> wrote:
> > Dear R-Help,
>
> > Is it possible to set R up to run a particular script at specific
> > times of the day? trivial example: If the time is now 8:59:55am and I
> > wish to run a function at 9am, I do the following:
>
> > my.function <- function(x) {
> >    p1 <- proc.time()
> >    Sys.sleep(x)
> >    print('Hello R-Help!')
> >    proc.time() - p1
> > }
> > my.function (5)
>
> > [1] "Hello R-Help!"
> >   user  system elapsed
> >      0       0       5
>
> > What I would rather do is just put in the time at which I wish R to
> > execute at.
>
> > Hope that made sense, and thanks for any help in advance!
> > TonyBreyal
>
> > ### Windows Vista
> >> sessionInfo()
> > R version 2.7.2 (2008-08-25)
> > i386-pc-mingw32
>
> > locale:
> > LC_COLLATE=English_United Kingdom.1252;LC_CTYPE=English_United Kingdom.
> > 1252;LC_MONETARY=English_United Kingdom.
> > 1252;LC_NUMERIC=C;LC_TIME=English_United Kingdom.1252
>
> > attached base packages:
> > [1] stats     graphics  grDevices utils     datasets  methods
> > base
>
> > loaded via a namespace (and not attached):
> > [1] RCurl_0.9-4
>
> > ______________________________________________
> > R-h... at r-project.org mailing list
> >https://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.
>
> --
> Jim Holtman
> Cincinnati, OH
> +1 513 646 9390
>
> What is the problem that you are trying to solve?
>
> ______________________________________________
> 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