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]]

