Skip to content

removeMethods (methods) does not work in my examples (PR#2519)

1 message · Brian Ripley

#
R 1.6.2 (also R-devel 2003-02-01)

An example from S Programming:

library(methods)
setClass("xyloc", representation(x="numeric", y="numeric"))
setClass("fungi", representation("xyloc", species="character"))

show.fungi <- function(object) {
  tmp <- rbind(x = format(round(object@x, 2)),
               y = format(round(object@y, 2)),
               species = object@species)
  dimnames(tmp)[[2]] <- rep("", length(object@x))
  print(tmp, quote=F)
  invisible(object)
}
setMethod("show", "fungi", show.fungi)  ## works

removeMethod("show", "fungi") ## works in S4 but R gives
Error in identical(args[1], "...") : Object "fnames" not found