[R] getting R to download data
Greg Snow
Greg.Snow at imail.org
Wed Dec 8 05:03:21 CET 2010
If you don't want to use the OS (windows does have a scheduling service) then I would suggest using the tools in tcltk and possibly tcltk2 (tclTaskSchedule). They can have a delayed thing in the background so you can still use the R console, but the download will happen automatically.
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Ben Bolker
> Sent: Tuesday, December 07, 2010 4:47 PM
> To: r-help at stat.math.ethz.ch
> Subject: Re: [R] getting R to download data
>
> <sachinthaka.abeywardana <at> allianz.com.au> writes:
>
> > Is it possible to write a program such that it downloads a csv from a
> given
> > web address? Would be great if this could be done at a particular
> time
> > during the day as well. Say 9AM monday-friday.
>
>
> downloading a csv file is easy:
>
> x <- read.csv(url("http://whatever.com/my.csv"))
>
> for scheduling this you probably want to use some scheduling
> tool that works with your OS (in Unix/Linux you would use
> "cron") and run R in batch mode (R CMD BATCH ...)
>
> I suppose you could leave an R job running all the time, having
> it go to sleep (?Sys.sleep) in between calls -- I don't know if
> Sys.sleep(24*3600) would reliably put it to sleep for a whole day --
> but scheduling through the operating system would certainly be
> a better way to do it.
>
> ______________________________________________
> R-help at 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.
More information about the R-help
mailing list