Skip to content
Prev 309858 / 398502 Next

Replace array with percentile values

rank() would do it:
   > x <- c(1,2,2,2,2,3,4,4,5,5)
   > rank(x, ties="max")/length(x)  * 100
    [1]  10  50  50  50  50  60  80  80 100 100
as would ecdf()
   > ecdf(x)(x)*100
    [1]  10  50  50  50  50  60  80  80 100 100

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com