search for: myperc

Displaying 1 result from an estimated 1 matches for "myperc".

Did you mean: mypera
2011 Mar 10
1
getting percentiles by factor
...) myExample <- na.omit(myExample) Thanks to Patrick I I managed to put together the following lines which does it for the "Ret" column: myecdf <- function(x, sortAsc) { w1 <- ecdf(x$Ret) w2 <- if (sortAsc) w1(x$Ret) * 100 else abs(w1(x$Ret) * 100 - 100) w3 <- transform(x, myPerc=w2) return(w3) } myExampleEnd <- lapply(split(myExample, myExample$Sectors), myecdf, sortAsc="True") myExampleEnd <- unsplit(myExampleEnd, myExample$Sectors) I need to make the function more flexible accepting the name of the column to calculate percentiles on as a parameter but t...