[R] Lowest values in a vector of numbers

Dennis Murphy djmuser at gmail.com
Fri Jul 29 07:28:19 CEST 2011


> x <- rpois(50, 10)
> which(x <= quantile(x, 0.2))
 [1]  7 14 16 24 25 28 33 44 45 48
> x[which(x <= quantile(x, 0.2))]
 [1] 6 5 4 5 7 7 4 5 6 7
> quantile(x, 0.2)
20%
7.8

HTH,
Dennis

On Thu, Jul 28, 2011 at 9:42 PM, Jim Silverton <jim.silverton at gmail.com> wrote:
> I have a vector of numbers, and I will like to find the positions of the
> lowest 20% of the values. Can anyhow point out how to do this. I tried the
> ecdf function but to no avail.
>
>
>
> --
> Thanks,
> Jim.
>
>        [[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