[R] Percentiles in R

Stefan Grosse singularitaet at gmx.net
Tue Sep 11 18:31:26 CEST 2007


-------- Original Message  --------
Subject: Re: [R] Percentiles in R
From: Jose Luis Aznarte M. <jlaznarte at decsai.ugr.es>
To: r-help at stat.math.ethz.ch
Date: 11.09.2007 19:09
>     Thank you all! But the problem is that quantile() returns "how many 
> data" are greater than p percent, and not a value in the domain of the 
> vector under scrutiny. For example, I have a vector
>
>  > x
>  [1] "-0,39559"  "1,1916"    "0,23214"   "1,656"     "-0,3439"   "-0,50568"
>  [7] "0,52281"   "0,96209"   "0,0087242" "-0,030727" "1,0935"    "0,35159" 
> [13] "0,79229"   "0,81791"   "0,3186"    "1,0165"    "0,65567"   "-0,56474"
> [19] "-0,34662"  "0,70435"   "-0,73285"  "-0,60452"  "-0,92526"  "-0,296"  
> [25] "0,51298"   "0,38654"   "0,32469"   "-0,92555"  "0,53023"   "0,050059"
> [31] "1,09"      "-0,35462"  "0,37674"   "1,1409"    "0,072098"  "1,4234"  
> [37] "1,43"      "0,68532"   "0,078089"  "0,61944" 
>
>   
It looks like you imported x as strings not as numbers.

look at this:
> x<-rnorm(50,mean=1)
> x
 [1]  0.21491438  0.03133966  3.60057440  4.15322486  0.96381522  1.34283032
 [7] -0.44273854 -0.53095683 -0.80736505  0.63407897  0.74989143  0.76629350
[13]  1.47503369  1.33359076  0.55049496  2.38543014  0.29774612  0.95834111
[19]  0.27763564 -0.15241260 -0.25558855  1.99413840  0.93002691  0.65026853
[25]  2.89999171  1.57017766 -0.20427214  1.05860619  0.74690706  0.95646603
[31]  0.90801464 -0.18236578  0.24682773  1.57208695  1.05569796  0.79504514
[37]  0.78895742  0.66675315  1.33666759  0.87238647 -1.12956668  0.44982951
[43]  0.25748181  0.82173105  0.86385613  1.03523168  0.17719826  2.59587957
[49]  2.22803895  2.45127783
> quantile(x,probs=0.1)
       10%
-0.2094038

Stefan
-=-=-
... When the center does not hold, the circle falls apart.  (Lao Tzu)



More information about the R-help mailing list