[R] subset with two factors

Martin Spindler Martin.Spindler at gmx.de
Fri Dec 10 12:25:13 CET 2010


Dear all,

I have a dataframe of the following strucutre

 numacc_b coverage_b Geschlecht GG
1        0          1          W  A
2        0          1          M  A
3        0          1          M  B
4        0          1          M  B
5        0          1          W  A
6        0          1          M  B

I would like to form a subset consisting of all entries with Geschlecht=M and GG=A.

Using

>T1 <- subset(daten1, Geschlecht=="M", GG=="A")

delievers

data frame with 0 columns and 6 rows

> T1 <- subset(daten1, Geschlecht=="M")

delievers

  numacc_b coverage_b Geschlecht GG
2         0          1          M  A
3         0          1          M  B
4         0          1          M  B
6         0          1          M  B
9         0          1          M  B
10        0          1          M  B

But I want to select the dataframe according to both factos.

What can I do?

Thank you answers in advance!

Best,

Martin
-- 
GMX DSL Doppel-Flat ab 19,99 €/mtl.! Jetzt auch mit 
gratis Notebook-Flat! http://portal.gmx.net/de/go/dsl



More information about the R-help mailing list