[R] percent by subset

David Winsemius dwinsemius at comcast.net
Sun May 2 20:23:01 CEST 2010


On May 2, 2010, at 1:58 PM, Geoffrey Smith wrote:

> Suppose my data looks like this:
>
> Obs,     Male,     Female,     Height
> 1,          T,           F,               66
> 2,          F,           T,               64
> 3,          T,           F,               59
> 4,          T,           F,               55
> 5,          F,           T,               62
> 6,          T,           F,               67
> 7,          T,           F,               58
> 8,          T,           F,               57
> 9,          F,           T,               58
> 10,        T,           F,               62
>
> How can I find the percentage of Males with a Height of over 60?   
> Likewise,
> how can I find the percentage of Females with a Height of over 60?

R-help expects you to read the introductory materials offered at CRAN,  
of which there are quite a few examples,  before posting  
questions, ...  especially when they look like homework.

Here's what you should do:   Get this into R using the read functions,  
read the Posting Guide to see one method of creating reproducible  
versions of R objects or look at the dput function for another method.  
Then and only then post your homework question as reprocucible R code   
and further hints will perhaps be offered.
>
-- 

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list