[R] data.frame: how to extract parts

Jörg Groß joerg at licht-malerei.de
Sat Jan 17 03:57:13 CET 2009


Hi,

I have a problem with the R syntax.
It's perhaps pretty simple, but I don't understand it ...


I can extract a column from a data.frame with the following code for  
example ...


b$row1[b$row1 == "male"]


so I see all male-entries.


But I cannot extract all lines of a data.frame depending on this  
criterium;

only.male <- b[b$row1 == "male"]


With that, I get an "undefined columns selected" message.


So how can I extract lines of a data.frame depending on a level  
variable?




More information about the R-help mailing list