[Rd] Can't make sort generic in quantile (S3)

miguel manese jjonphl at gmail.com
Mon Aug 7 03:01:15 CEST 2006


Hello all,

In my package I made sort() generic as follows:

sort.default <- sort; sort <- function(x, ...) UseMethod("sort");
formals(sort.default) <- c(formals(sort.default), alist(...=))

then added a sort for my S3 class

sort.sqlite.vector <- function(x, decreasing=FALSE, ...) {
    .Call("sdf_sort_variable", x, as.logical(decreasing))
}

In the stats::quantile() function, sort() is still bound to the
original definition. I got the following error when calling quantile:

Error in sort(x, partial = unique(c(lo, hi))) :
        'x' must be atomic

However, when I copy quantile's def'n (say as myquantile in
myquantile.R), source() it then do myquantile(x), I get the results.

Thanks,
M. Manese



More information about the R-devel mailing list