[R] subset with two factors

Martin Spindler Martin.Spindler at gmx.de
Fri Dec 10 12:47:27 CET 2010


Hey Michael,

Thank you very much. It works!

Best,

Martin


-------- Original-Nachricht --------
> Datum: Fri, 10 Dec 2010 22:35:56 +1100
> Von: Michael Bedward <michael.bedward at gmail.com>
> An: Martin Spindler <Martin.Spindler at gmx.de>
> CC: r-help at r-project.org
> Betreff: Re: [R] subset with two factors

> Hello Martin,
> 
> You were almost there :)
> 
> T1 <- subset(daten1, Geschlecht=="M" & GG=="A")
> 
> Hope this helps.
> 
> Michael
> 
> On 10 December 2010 22:25, Martin Spindler <Martin.Spindler at gmx.de> wrote:
> > 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
> >
> > ______________________________________________
> > R-help at 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.
> >

-- 
GRATIS! Movie-FLAT mit über 300 Videos. 



-- 
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