[R] cut a vector in equal parts

jim holtman jholtman at gmail.com
Tue Feb 26 19:01:32 CET 2013


?sort
?cut

On Tue, Feb 26, 2013 at 12:39 PM, Martin Batholdy
<batholdy at googlemail.com> wrote:
> Hi,
>
> I would like to cut a vector of values in parts.
> Each part should have an equal number of elements.
>
> for example:
>
> x <- (rnorm(500)^2)
>
> now I want 5 vectors each with 100 elements.
> The first vector should include the 100 lowest values of x and so on
> (so that the fifth vector contains the 100 highest values of x).
>
>
> thanks for any help!
>
> ______________________________________________
> 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.



-- 
Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.



More information about the R-help mailing list