Hello, i am trying to understand the difference between S3 function print and S4 method.
My main problem is that i need to count the environment ("frames") (i use /eval/() afterwards with /parent.frame/() ). If I use a S4 method/print/, a 'hidden' environment seem to appears. It is not the case, with generic methods declared in the methods package such as /show/ . I would like to understand the difference and how to declare them in a namespace (avoiding this +1 frame if possible). Here a small example: setClass('test', representation=representation(a="numeric")) testobject <- new(Class='test', a=1) setMethod("show", signature='test', definition=function(object){ aa <- sys.nframe() print(aa) }) testobject ##show : 2 print.test <- function(x){ aa <- sys.nframe() print(aa) } print(testobject) #2 setMethod("print", signature='test', definition=function(x){ aa <- sys.nframe() print(aa) }) print(testobject) # 3, what happened? Thanks, Alice Julien-Laferriere [[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.