>>>>> "Shiazy" == Shiazy Fuzzy <[EMAIL PROTECTED]> >>>>> on Wed, 30 May 2007 20:07:24 +0200 writes:
Shiazy> Hi! Shiazy> I've noticed the ecdf() R code (R ver. 2.5.0) contains two call to sort: Shiazy> --- [R-code] --- Shiazy> ecdf <- function(x) Shiazy> x <- sort(x) Shiazy> n <- length(x) Shiazy> if (n < 1) Shiazy> stop("'x' must have 1 or more non-missing values") Shiazy> vals <- sort(unique(x)) Shiazy> rval <- approxfun(vals, cumsum(tabulate(match(x, vals)))/n, Shiazy> method = "constant", yleft = 0, yright = 1, f = 0, ties = "ordered") Shiazy> class(rval) <- c("ecdf", "stepfun", class(rval)) Shiazy> attr(rval, "call") <- sys.call() Shiazy> rval Shiazy> --- [/R-code] --- Shiazy> I think one of the two calls to sort can be removed, improving the performance. Shiazy> What do you think? I agree, and I have removed the 2nd one. Thank you for your note. Martin Shiazy> Sincerely, Shiazy> -- Marco Shiazy> ______________________________________________ Shiazy> R-devel@r-project.org mailing list Shiazy> https://stat.ethz.ch/mailman/listinfo/r-devel ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel