[R] Percentile rank for each element in list

Peng, C cpeng.usm at gmail.com
Tue Sep 7 15:44:21 CEST 2010


Is this what you want to have:

> x <- c(1,5,100,300,250,200,550,900,1000) 
> # assume you want the position of 25th percentile
> which(x==quantile(x,0.25))
[1] 3

Note that "position" is meaningful only when the percentile is one of the
observed data values. If you want to know the "position" of 70th percentile
(that is between "position" 6 and "position" 7). You need to do something
coding to get these two adjacent "positions".
-- 
View this message in context: http://r.789695.n4.nabble.com/Percentile-rank-for-each-element-in-list-tp2529523p2529741.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list