Dear Jörg, Try this: # Data DF=read.table(textConnection(" row1 row2 row3 x 2 3 x 1 4 y 5 3 y 2 3"),header=TRUE) closeAllConnections()
# Splitting res=with(DF,split(DF,row1)) res # To access the first data.frame just type res$x See ?split for more details. HTH, Jorge On Mon, Dec 15, 2008 at 8:43 PM, Jörg Groß <jo...@licht-malerei.de> wrote: > Hi, > > I have a data frame with several columns. > > Now I want to transfer the data into a new variable (also a data frame), > but I only want a part of the data, defined by a rule ... > > > for example; I have following data frame: > > row1 row2 row3 > x 2 3 > x 1 4 > y 5 3 > y 2 3 > > I know want a data frame, only with lines containing x in row1. > > I know how to do that for one row (f <- d$row2[d$row1=="x"]). > But how can I do that for all rows in one step? > > > So that I get this for f: > > row1 row2 row3 > x 2 3 > x 1 4 > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.