Re: [R] transforming a badly organized data base into a list of data frames

2009-09-04 Thread Gabor Grothendieck
Try this: x2 <- subset(x, A != "") split(x2, cumsum(x2$B == "")) On Fri, Sep 4, 2009 at 8:57 AM, Dimitri Liakhovitski wrote: > Dear R-ers! > > I have a badly organized data base in Excel. Once I read it into R it > looks like this (all variables become factors because of many spaces > and other

Re: [R] transforming a badly organized data base into a list of data frames

2009-09-04 Thread Henrique Dallazuanna
Try this: lapply(grep("Name", x$A), function(idx)x[idx + 1:3,]) On Fri, Sep 4, 2009 at 9:57 AM, Dimitri Liakhovitski wrote: > Dear R-ers! > > I have a badly organized data base in Excel. Once I read it into R it > looks like this (all variables become factors because of many spaces > and other c

[R] transforming a badly organized data base into a list of data frames

2009-09-04 Thread Dimitri Liakhovitski
Dear R-ers! I have a badly organized data base in Excel. Once I read it into R it looks like this (all variables become factors because of many spaces and other characters in Excel): x<-data.frame(A=c("","Name1","text1","text2","text3","","","","Name2","text1","text2","text3","","","Name3","text1