[R] recording age into different variables

Ista Zahn istazahn at gmail.com
Mon Aug 25 19:59:42 CEST 2014


Hi Andrew,

See ?cut and ?table, e.g.,

table(cut(Age, c(0, 10, 20, 30), include.lowest=TRUE))

should do it.

Best,
Ista

On Mon, Aug 25, 2014 at 11:34 AM, Andrew Kabala <kabalaandrew at gmail.com> wrote:
> Hi,
> I am new to R, I would like to know how i can summarize age data into
> different categories i.e.
> Age
> 14
> 16
> 20
> 60
> 45
> .
> .
> I would like to generate a summary for example showing the frequencies in
> each custom defined group
> 0-10 yrs  11-20 years 21-30 years
> 20             5               6
>
> many thanks
> Andrew
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.



More information about the R-help mailing list