From suharto_anggono at yahoo.com  Tue Feb  5 12:09:45 2013
From: suharto_anggono at yahoo.com (Suharto Anggono Suharto Anggono)
Date: Tue, 5 Feb 2013 03:09:45 -0800 (PST)
Subject: [Rd] 'ecdf': how about exploiting property that 'x' is sorted?
Message-ID: <1360062585.31414.YahooMailClassic@web125106.mail.ne1.yahoo.com>

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, ...)



[Rd] 'ecdf': how about exploiting property that 'x' is sorted?
Suharto Anggono Suharto Anggono