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

miguel manese jjonphl at gmail.com
Tue Aug 8 01:37:31 CEST 2006


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
defined (w/c was the cause of my problem)


On 8/7/06, Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote:
> It's a namepsace issue: any function in a namespace will see the
> definition in base rather than yours.
I'm not sure about this, because is.list above worked for me. Maybe
this is just part of the rule?

> 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).
The vector (class sqlite.vector) to be sorted is a column in the
database, and its sort is done by the db engine's sort whose result is
written to another table. I was trying to implement quantile, but
seeing that I was just copying the entire function (I never would have
imagined that there are that many ways to compute quantiles), I
experimented a bit and found out that it should be ok considering I
have implemented sort() already.


M. Manese



More information about the R-devel mailing list