It's a namepsace issue: any function in a namespace will see the 
definition in base rather than yours.

quantile() is already generic, so why do you want to make sort() generic?
In particular, the function you show is not implementing much of the power 
of sort (and in this case in particular not partial sorting).

On Mon, 7 Aug 2006, miguel manese wrote:

> 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
> 
> ______________________________________________
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
> 

-- 
Brian D. Ripley,                  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to