table(cut(numbers, c(0, 10, 20, 30, . . .), include.lowest=TRUE)) ---------------------------------------------- David L Carlson Associate Professor of Anthropology Texas A&M University College Station, TX 77843-4352
> -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Chintanu > Sent: Thursday, July 26, 2012 8:23 PM > To: r-help@r-project.org > Subject: [R] Counting frequency within each range > > Hi, > > This is a simple problem, but for the life of me I cannot find the > answer. > How to determine frequency within given ranges ? > I know that table() gives frequency, for example > > a <- table(numbers) > > a > numbers > 4 5 23 34 43 54 56 65 67 324 435 453 456 567 657 > 2 1 2 2 1 1 2 1 2 1 3 1 1 1 > 1 > > > as.data.frame(table(numbers)) > numbers Freq > 1 4 2 > 2 5 1 > 3 23 2 > 4 34 2 > ... > > However, there must be some simple way to get the frequency based on > ranges, such as 0-10, 10-20, 20-30 and so on. > Please help ! > > Thank you. > > Cheers, > Chintanu > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@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. ______________________________________________ R-help@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.