[R] converting a data-frame by a defined rule
Jörg Groß
joerg at licht-malerei.de
Tue Dec 16 02:43:48 CET 2008
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
More information about the R-help
mailing list