Skip to content
Prev 8768 / 63421 Next

Methods package is now attached by default

On Tue, 21 Jan 2003, Roger Peng wrote:

            
Not quite, because it doesn't use method dispatching -- it calls
plot.function explicitly.

I think it's a thinko in editing.  plot() went from
 plot<- function (x, ...)
 {
    if (is.null(attr(x, "class")) && is.function(x)) {
        if ("ylab" %in% names(list(...)))
            plot.function(x, ...)
        else plot.function(x, ylab = paste(deparse(substitute(x)),
            "(x)"), ...)
    }
    else UseMethod("plot")
 }
to
 plot<-function (x, y, ...)
{
    if (is.null(attr(x, "class")) && is.function(x)) {
        if ("ylab" %in% names(list(...)))
            plot.function(x, ...)
        else plot.function(x, ylab = paste(deparse(substitute(x)),
            "(x)"), ...)
    }
    else UseMethod("plot")
}

but the extra argument `y' never got passed down to plot.function. It
should be something like
function (x, y, ...)
{
    if (is.null(attr(x, "class")) && is.function(x)) {
        if ("ylab" %in% names(list(...)))
            plot.function(x,y, ...)
        else plot.function(x, y, ylab = paste(deparse(substitute(x)),
            "(x)"), ...)
    }
    else UseMethod("plot")
}


	-thomas