Skip to content

Downloading a .csv through a .jsp url with variable parameters - R code or package?

4 messages · Arsenio Staer, jim holtman

#
Dear R experts,

I'm trying to download a .csv file with daily data on the companies through
a javascript url ending in .jsp of the following form:
http://....... .com/.../.../filename.jsp?y=2004&m=3&d=9
where y = year, m = month and d=day. Accessing the link gives you the .csv
for that date. I want to download the whole time series day by day say from
y = 2000 to 2010 into an R dataset. Any idea how to do that through R code?

Thanks a lot in advance!

Arsenio
3 days later
#
So i realized putting this 
raw.untr <- as.data.frame(read.csv(file='.......jsp?y=2008&m=09&d=30',
header = TRUE, as.is = TRUE))

reads the file prefectly, so i was wondering how can i create a set of
dataframes each with observations for one day (say for 3 years with 250 days
of data each year = 750 datasets) ? And in each loop of a cycle the text
string in the url would change to reflect the new date, say from
y=2008&m=09&d=30 to y=2008&m=09&d=31?

Any help would be great, i somewhat expected more of a reaction given how
vibrant R community is,

Arsenio
#
Something like this should work, only Sept has 30 days, not 31:
+             , format(files, "%Y")
+             , "&m="
+             , format(files, "%m")
+             , "&d="
+             , format(files, "%d")
+             , sep = ""
+             )
[1] ".....jsp?y=2008&m=09&d=30" ".....jsp?y=2008&m=10&d=01"
[3] ".....jsp?y=2008&m=10&d=02" ".....jsp?y=2008&m=10&d=03"
[5] ".....jsp?y=2008&m=10&d=04" ".....jsp?y=2008&m=10&d=05"

        
On Mon, Dec 6, 2010 at 8:18 PM, Arsenio Staer <arsenio.staer at gmail.com> wrote:

  
    
#
Jim,

Thanks a lot! works perfectly! now i just use a for loop and rbind to create
one dataset with all daily observations.

Arsenio