[R] Splitting a vector into equal groups

ronggui ronggui.huang at gmail.com
Mon May 4 09:03:16 CEST 2009


lattice:::equal.count may be what you want.

2009/5/4 utkarshsinghal <utkarsh.singhal at global-analytics.com>:
> Hi All,
>
> I have vector of length 52, say, x=sample(30,52,replace=T). I want to
> sort x and split into five *nearly equal groups*. Note that the
> observations are repeated in x so in case of a tie I want both the
> observations to fall in same group.
> This seems a very common task to do, but still I couldn't find an R
> function to do this. Any help would be highly appreciated.
>
> Regards
> Utkarsh
>
>
>
>        [[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.
>



-- 
HUANG Ronggui, Wincent
PhD Candidate
Dept of Public and Social Administration
City University of Hong Kong
Home page: http://asrr.r-forge.r-project.org/rghuang.html




More information about the R-help mailing list