[R] tracking data

Prof Brian Ripley ripley at stats.ox.ac.uk
Sat Nov 17 18:54:56 CET 2001

On Sat, 17 Nov 2001, Dirk Eddelbuettel wrote:

>   "Christian" == ozric  <ozric at web.de> writes:
>   Christian>  hello, is it possible in R to combine with a RODBC query a
>   Christian> timing/date function to refresh plots and analysis after a time
>   Christian> step automatic ( example: i get via php/mySql every day 100
>   Christian> records and would like refresh a linear regression every end of
>   Christian> day at 8.00 p.m. ) ?
> Yes, in particular with the tcltk toolkit and its event loop.  I can't name
> the command with which you would control the event loop, though.
> If you want to keep it in R itself, just use something like
>    while(1) {
>      do_my_data_gathering_from_mySQL()
>      do_my_plotting()
>      Sys.sleep(24*60*60)	# sleep one day
>    }
> with suitable code in those two do_my_* functions.

Or run a shorter sleep loop, say for 5 minutes, and use Sys.time()) to
check that it's after 8pm and the update has not been run that day.

But I would set a cron job to launch R and run an update script at 8pm
every night.  That would work even if you get a system reboot (or even an
R crash).

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list