[R] extracting from a data.frame
Sean Davis
sdavis2 at mail.nih.gov
Fri Jan 28 19:32:43 CET 2005
Look at ?subset.
Sean
On Jan 28, 2005, at 1:26 PM, dax42 wrote:
> Hi,
>
> I am sorry for this simple question, but... How do I extract something
> from a data.frame?
> The following is my Problem:
> I have got a dataframe "a" with various columns. One of those columns
> is called V3 and contains elements of the following levels:
>
> > levels(a$V3)
> [1] "C" "CA" "CB" "CD" "CD1" "CD2" "CE" "CE1" "CE2" "CE3" "CG"
> [12] "CG1" "CG2" "CH2" "CZ" "CZ2" "CZ3" "N" "ND1" "ND2" "NE" "NE1"
> [23] "NE2" "NH1" "NH2" "NZ" "O" "OD1" "OD2" "OE1" "OE2" "OG" "OG1"
> [34] "OH" "OXT" "SD" "SG"
>
> Now I would like to get all rows of a, that have the value "O" in V3.
> I tried a lot of different combinations of [... but I couldn't make it.
>
> Any ideas?
> Thanks a lot!
> Dax.
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html
More information about the R-help
mailing list