Re: [R] How to extract following data

2008-11-05 Thread Gabor Grothendieck
Just one comment. The code posted works as shown but if in your case Lines is actually composed of separate lines rather than one big string as in my example then you will need to add a simplify = c argument to each strapply call. On Wed, Nov 5, 2008 at 7:32 AM, Gabor Grothendieck <[EMAIL PROTECT

Re: [R] How to extract following data

2008-11-05 Thread Gabor Grothendieck
Here is another solution made slightly shorter by using strapply twice: z <- zoo(strapply(Lines, "[0-9]+[.][0-9]+", as.numeric)[[1]], strapply(Lines, "-..-..", as.Date)[[1]]) or to create a data frame: DF <- data.frame(date = strapply(Lines, "-..-..", as.Date)[[1]], price = strapp

Re: [R] How to extract following data

2008-11-05 Thread Gabor Grothendieck
As others have pointed out its close to XML but not quite there; however, you could use strapply in gsubfn to extract the data. It pulls out the data matching the regular expression giving vector, vec, consisting of: date price date price ... Pulling out even and odd elements separately and conver

Re: [R] How to extract following data

2008-11-04 Thread Dieter Menne
RON70 yahoo.com> writes: > > - > 2005-01-17T00:00:00+05:30 > 10149 > 1288.40002 > Looks suspiciously like XML, and let's hope the real data are more like this below, without the "-" and with a nice header 2005-01-17T00:00:00+05:30 10149 1288.40002 2005-01-18T0

[R] How to extract following data

2008-11-04 Thread RON70
Hi everyone, I have this kind of raw dataset : - 2005-01-17T00:00:00+05:30 10149 1288.40002 - 2005-01-18T00:00:00+05:30 10149 1291.69995 - 2005-01-19T00:00:00+05:30 10149 1288.19995 I was looking for some R procedure to extract data from this, that should