Hello the list, As a simple example:
> rm(list = ls())> setClass("tre", representation(x="numeric"))> > setMethod("show", "tre", def = function(object) cat(object@x))[1] "show"> > setMethod("summary", "tre", def = function(object) cat("This is a tre of > value ", object@x, "\n"))Creating a generic function for summary from > package base in the global environment[1] "summary"> ls()[1] "summary" R copies generic summary into the current environment. I understand it as: If you want R to create a specific "summary" method for objects of class "tre" R needs the generic method in the same environment (R_GloabalEnv). In fact, summary is listed by ls in in my local env. Why R does not do the same with generic method "show"? I know that generic method "show" is from package "methods" while summary is package "base". Does it matter somehow? Can anyone point me to the right reference? Thanks in advance for your help ... Andrea [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.