[Rd] tracing nonstandardGenericFunction

Torsten Hothorn hothorn at ci.tuwien.ac.at
Tue Aug 12 13:10:46 MEST 2003


Hi, 

how can one trace a nonstandardGenericFunction,
especially "initialize"? An example:

setClass("dummy", representation(a = "numeric"))

setMethod("initialize", "dummy", 
          function(.Object, a = 2) { ### I want to trace this function
              .Object at a <- a
              .Object
          })

setMethod("show", "dummy", function(object) print(object at a))

b <- new("dummy", a = 3)

trace("show", browser, signature = "dummy") ### trace method "show" to
                                            ### class "dummy"

show(b) ### works fine

trace("initialize", browser, signature = "dummy")

R> b <- new("dummy") ### does not trace the function of interest ...
Tracing initialize(value, ...) on entry 
Called from: initialize(value, ...)

Best,

Torsten



More information about the R-devel mailing list