Suharto Anggono Suharto Anggono
2013-Feb-05 11:09 UTC
[Rd] 'ecdf': how about exploiting property that 'x' is sorted?
In the code of function 'ecdf' di R (for example, version 2.15.2), input 'x' is sorted first. Because the values are sorted, same values are contiguous. So, how about using an approach as inside function 'rle'? Because missing values is removed by 'sort', it can be done like this. i <- c(which(x[-1L] != x[-n]), n) rval <- approxfun(x[i], i/n, ...)