[R] R function for percentrank
John Kane
jrkrideau at yahoo.ca
Sat Dec 1 17:33:12 CET 2007
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
--- tom soyer <tom.soyer at gmail.com> wrote:
> 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.
>
More information about the R-help
mailing list