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]]
Before posting further: 1. Read the posting guide linked to at the bottom of this message. In particular note: no HTML,please. 2. Do your due diligence. Spend some time with an R tutorial to learn the basics -- we should not have to answer questions that with minimal effort you could answer for yourself. This one ships with R, but there are many other good ones on the web: http://cran.r-project.org/doc/manuals/R-intro.pdf Cheers, Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 "Data is not information. Information is not knowledge. And knowledge is certainly not wisdom." Clifford Stoll On Mon, Aug 25, 2014 at 8: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.
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.