Re: [R] reading data from web data sources

2010-02-27 Thread Gabor Grothendieck
Here is a continuation to turn DF into a zoo series: It depends on the fact that all NAs are structural, i.e. they indicate dates which cannot exist such as Feb 31 as opposed to missing data. dd is the data as one long series with component names being the dates in the indicated format. That is

Re: [R] reading data from web data sources

2010-02-27 Thread David Winsemius
On Feb 27, 2010, at 6:17 PM, Phil Spector wrote: Tim - I don't understand what you mean about interleaving rows. I'm guessing that you want a single large data frame with all the data, and not a list with each year separately. If that's the case: x = read.table('http://climate.arm.ac.

Re: [R] reading data from web data sources

2010-02-27 Thread Phil Spector
Tim - I don't understand what you mean about interleaving rows. I'm guessing that you want a single large data frame with all the data, and not a list with each year separately. If that's the case: x = read.table('http://climate.arm.ac.uk/calibrated/soil/dsoil100_cal_1910-1919.dat',

Re: [R] reading data from web data sources

2010-02-27 Thread David Winsemius
On Feb 27, 2010, at 4:33 PM, Gabor Grothendieck wrote: No one else posted so the other post you are referring to must have been an email to you, not a post. We did not see it. By one off I think you are referring to the row names, which are meaningless, rather than the day numbers. The data

Re: [R] reading data from web data sources

2010-02-27 Thread Phil Spector
Sorry, I forgot to cc the group: Tim - Here's a way to read the data into a list, with one entry per year: x = read.table('http://climate.arm.ac.uk/calibrated/soil/dsoil100_cal_1910-1919.dat', header=FALSE,fill=TRUE,skip=13) cts = apply(x,1,function(x)sum(is.na(x))) wh = whic

Re: [R] reading data from web data sources

2010-02-27 Thread Gabor Grothendieck
No one else posted so the other post you are referring to must have been an email to you, not a post. We did not see it. By one off I think you are referring to the row names, which are meaningless, rather than the day numbers. The data for day 1 is present, not missing. The example code did re

Re: [R] reading data from web data sources

2010-02-27 Thread Tim Coote
Thanks, Gabor. My take away from this and Phil's post is that I'm going to have to construct some code to do the parsing, rather than use a standard function. I'm afraid that neither approach works, yet: Gabor's gets has an off-by-one error (days start on the 2nd, not the first), and the ye

Re: [R] reading data from web data sources

2010-02-27 Thread Gabor Grothendieck
Mark Leeds pointed out to me that the code wrapped around in the post so it may not be obvious that the regular expression in the grep is (i.e. it contains a space): "[^ 0-9.]" On Sat, Feb 27, 2010 at 7:15 AM, Gabor Grothendieck wrote: > Try this.  First we read the raw lines into R using grep t

Re: [R] reading data from web data sources

2010-02-27 Thread Gabor Grothendieck
Try this. First we read the raw lines into R using grep to remove any lines containing a character that is not a number or space. Then we look for the year lines and repeat them down V1 using cumsum. Finally we omit the year lines. myURL <- "http://climate.arm.ac.uk/calibrated/soil/dsoil100_cal

[R] reading data from web data sources

2010-02-27 Thread Tim Coote
Hullo I'm trying to read some time series data of meteorological records that are available on the web (eg http://climate.arm.ac.uk/calibrated/soil/dsoil100_cal_1910-1919.dat) . I'd like to be able to read in the digital data directly into R. However, I cannot work out the right function and