[R] grouping
Petr Savicky
savicky at cs.cas.cz
Tue Apr 3 15:42:31 CEST 2012
On Tue, Apr 03, 2012 at 09:31:29AM -0400, Val wrote:
> Thank you all (David, Michael, Giovanni) for your prompt response.
>
> First there was a typo error for the group mean it was 89.6 not 87.
>
> For a small data set and few groupings I can use prob=c(0, .333, .66 ,1)
> to group in to three groups in this case. However, if I want to extend the
> number of groupings say 10 or 15 then do I have to figure it out the
> split(x, cut(x, quantile(x, prob=c(0, .333, .66 ,1))
>
> Is there a short cut for that?
Hi.
There may be better ways for the whole task, but specifically
c(0, .333, .66 ,1) can be obtained as
seq(0, 1, length=3+1)
Hope this helps.
Petr Savicky.
More information about the R-help
mailing list