Re: [R] R function for percentrank

From: John Kane <jrkrideau_at_yahoo.ca>
Date: Sat, 1 Dec 2007 11:33:12 -0500 (EST)


I don't see one but that means nothing. I think you can write such a function in a few minutes

Will something like this work or am I
missunderstanding what Excel's percentrank does ?

aa <- rnorm(25); aa # data vector
percentrank <- function(x) {
var <- sort(x)
p.rank <- 1:length(var)/length(var)*100
dd <- cbind(var,p.rank)
}
pr <- percentrank(aa); pr

> Hi,
>
> Does anyone know if R has a built-in function that
> is equvalent to Excel's
> percentrank, i.e., returns the rank of a value in a
> data set as a percentage
> of the data set?
>
> Thanks,
>
> --
> Tom
>
> [[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.
>



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. Received on Sat 01 Dec 2007 - 16:47:17 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 01 Dec 2007 - 18:30:16 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.