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

Tony Breyal tony.breyal at googlemail.com
Mon Oct 13 17:44:33 CEST 2008


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!
Tony Breyal

### 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



More information about the R-help mailing list