Skip to content
Prev 8752 / 63421 Next

Methods package is now attached by default

On Sun, 19 Jan 2003, Kurt Hornik wrote:

            
same happens e.g. with class "numeric":

ipredbagg <- function(y, ...) UseMethod("ipredbagg")

does NOT dispatch to ipredbagg.numeric if y IS of class "numeric". With
the "old" class(), this one worked:

ipredbagg.default <- function(y, ...) {
  # "numeric" is not an S3 class: check for regression problems and
  # the method dispatch should work for class(y) == "numeric"
  if (is.numeric(y)) {
    class(y) <- "numeric"
    return(ipredbagg(y, ...))
  } else {
    stop(paste("Do not know how to handle objects of class", class(y)))
  }
}

but now I need to call

return(ipredbagg.numeric(y, ...))

I think Brian is right with altering UseMethod() in a way taking care of
what class() tells us.
I can fix the code for ipred. The only problem is making it work for both
R-1.6.2  AND  R-devel :-)

Torsten