[R] NTH PERCENTILE COULMNWIESE

arun smartpink111 at yahoo.com
Wed Jul 18 14:02:22 CEST 2012


Hi
Try this:

mydat <-read.table(text="
ABC    XYZ
12          6
6            50
90        100
55          85
100        25
",sep="",header=TRUE)
apply(mydat,2,quantile,probs=0.2)
 ABC  XYZ 
10.8 21.2 
A.K.




----- Original Message -----
From: Rantony <antony.akkara at ge.com>
To: r-help at r-project.org
Cc: 
Sent: Wednesday, July 18, 2012 3:06 AM
Subject: [R] NTH PERCENTILE COULMNWIESE

Hi,

Here i have an matrix
mydat <- 
ABC    XYZ
-----     ------
12          6
6             50
90         100
55           85
100         25

i need to find the " NTH percentile "  [result should be in column-wise].
here i have a code for NTH percenile,

For eg:- if i need 20th-percentile then,
quantile(ncol(mydat),.2)  - here i getting output for complete matrix ,But i
need this for all the columnswise. like this,

for nth percentile
          ABC     XYZ
          ------    -------
20%   10        24    [here, given percentile value is not exact result, its
just for output format]

-Its urgent !

- Thanks 
Antony.


--
View this message in context: http://r.789695.n4.nabble.com/NTH-PERCENTILE-COULMNWIESE-tp4636839.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
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