Hi, I would like to select a few cases (for example cases corresponding to sex=male) to make summary for another variable. How can I do this. Thanks for your help Fawtzy
presuming that you have a data.frame look at "?subset()", e.g.,
# dat is your data.frame
subset(dat, sex=="male")
I hope it helps.
Best,
Dimitris
----
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven, Belgium
Tel: +32/16/336899
Fax: +32/16/337015
Web: http://www.med.kuleuven.ac.be/biostat/
http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm
----- Original Message -----
From: "Faouzi LYAZRHI" <f.lyazrhi at envt.fr>
To: <R-help at stat.math.ethz.ch>
Sent: Tuesday, April 19, 2005 4:18 PM
Subject: [R] select cases
> Hi,
> I would like to select a few cases (for example cases corresponding
> to sex=male) to make summary for another variable.
> How can I do this.
> Thanks for your help
> Fawtzy
>
> ______________________________________________
> 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
>
On Tue, 19 Apr 2005 16:18:14 +0200 Faouzi LYAZRHI wrote:> Hi, > I would like to select a few cases (for example cases corresponding to > sex=male) to make summary for another variable.Look at ?tapply. E.g. tapply(x, group, summary) Z> How can I do this. > Thanks for your help > Fawtzy > > ______________________________________________ > 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 >
subset(your.data.frame, your.data.frame$sex == 'male') cheers c Faouzi LYAZRHI wrote:> Hi, > I would like to select a few cases (for example cases corresponding to > sex=male) to make summary for another variable. > How can I do this. > Thanks for your help > Fawtzy > > ______________________________________________ > 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 > >