[R] Using unsplit - unsplit does not seem to reverse the effect of split

2005-09-27 Thread Søren Højsgaard
In data OME in MASS I would like to extract the first 5 observations per subject (=ID). So I do library(MASS) OMEsub - split(OME, OME$ID) OMEsub - lapply(OMEsub,function(x)x[1:5,]) unsplit(OMEsub, OME$ID) - which results in [[1]] [1] 1 1 1 1 1 [[2]] [1] 30 30 30 30 30 [[3]] [1] low low low

Re: [R] Using unsplit - unsplit does not seem to reverse the effect of split

2005-09-27 Thread Peter Dalgaard
Søren Højsgaard [EMAIL PROTECTED] writes: In data OME in MASS I would like to extract the first 5 observations per subject (=ID). So I do library(MASS) OMEsub - split(OME, OME$ID) OMEsub - lapply(OMEsub,function(x)x[1:5,]) unsplit(OMEsub, OME$ID) - which results in [[1]] [1] 1

Re: [R] Using unsplit - unsplit does not seem to reverse the effect of split

2005-09-27 Thread Marc Schwartz (via MN)
On Tue, 2005-09-27 at 19:12 +0200, Søren Højsgaard wrote: In data OME in MASS I would like to extract the first 5 observations per subject (=ID). So I do library(MASS) OMEsub - split(OME, OME$ID) OMEsub - lapply(OMEsub,function(x)x[1:5,]) unsplit(OMEsub, OME$ID) - which results in