[R] Counting frequency within each range
R. Michael Weylandt <michael.weylandt@gmail.com>
michael.weylandt at gmail.com
Fri Jul 27 03:44:36 CEST 2012
Combine cut() and table()
Michael
On Jul 26, 2012, at 8:22 PM, Chintanu <chintanu at gmail.com> wrote:
> 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 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