[R] split a data frame
Roger Peng
rpeng at stat.ucla.edu
Mon Jul 1 18:47:05 CEST 2002
It's simple, use the split() command. If AREA is a factor, then
data2 <- split(Data1, Data1$AREA)
should give you a list of dataframes split according to AREA.
-roger
_______________________________
UCLA Department of Statistics
rpeng at stat.ucla.edu
http://www.stat.ucla.edu/~rpeng
On Mon, 1 Jul 2002, Andrew McCulloch wrote:
> Hi ,
>
> I have a data frame (Data1) which has a area variable (AREA) with
> codes (RA,RG,LT etc.). I would like to split the data frame into
> individual data frames called RA, RG, LT conatining only the
> observations from those areas.
>
> Thanks
>
> yours sincerely
> Andrew McCulloch
>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list