sachinthaka.abeywardana at allianz.com.au
2010-Dec-07 22:28 UTC
[R] getting R to download data
Hi All,
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.
Incase you are curious Im just trying to analyse some stocks data.
Thanks,
Sachin
p.s. sorry about corporate notice
--- Please consider the environment before printing this email ---
Allianz - Best General Insurance Company of the Year 2010*
Allianz - General Insurance Company of the Year 2009+
* Australian Banking and Finance Insurance Awards
+ Australia and New Zealand Insurance Industry Awards
This email and any attachments has been sent by Allianz ...{{dropped:3}}
<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.