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

2006-08-07 Thread Prof Brian Ripley
On Tue, 8 Aug 2006, miguel manese wrote: > Thanks for the fix. I'm guessing the rules are: > > a. a non S3 method is bound to the global env, and will see the def'n > of an "S3-ized" method (e.g. I made is.list() generic and lapply, w/c > is not generic, gets the S3-ized is.list) > b. an S3 metho

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

2006-08-07 Thread miguel manese
Thanks for the fix. I'm guessing the rules are: a. a non S3 method is bound to the global env, and will see the def'n of an "S3-ized" method (e.g. I made is.list() generic and lapply, w/c is not generic, gets the S3-ized is.list) b. an S3 method implementation is bound to the namespace it was defi

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

2006-08-07 Thread Prof Brian Ripley
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

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

2006-08-06 Thread Gabor Grothendieck
Try redefining quantile.default: environment(quantile.default) <- .GlobalEnv For example, if you run the following in a fresh session it should print out X showing that the newly defined sort was invoked: environment(quantile.default) <- .GlobalEnv sort <- function(x, ...

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

2006-08-06 Thread miguel manese
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