[R] debugging an S4 method

John Chambers jmc at research.bell-labs.com
Tue Sep 7 16:46:20 CEST 2004

"Bickel, David" wrote:
> Does anyone know how to use the equivalent of debug() on an S4 method? I would like R to enter the browser not for the generic function, but for the method of the class that I specify.

This is what the trace() function does, if you supply the signature=
argument set to the class or combination of classes for which you want
to examine the selected method.

Typically, a call would be of the form:

trace("myFun", signature="myClass", browser, exit=browser)

which would call the browser on entry to the "myClass" method and again
before exiting.  See ?trace for details.

(There are a few bug fixes and added features in the upcoming 2.0.0

> Thanks,
> David
> _____________________________
> David Bickel  http://davidbickel.com
> Research Scientist
> Pioneer Hi-Bred International
> Bioinformatics & Exploratory Research
> 7250 NW 62nd Ave., PO Box 552
> Johnston, Iowa 50131-0552
> 515-334-4739 Tel
> 515-334-6634 Fax
> david.bickel at pioneer.com, bickel at prueba.info
> This communication is for use by the intended recipient and ...{{dropped}}
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

John M. Chambers                  jmc at bell-labs.com
Bell Labs, Lucent Technologies    office: (908)582-2681
700 Mountain Avenue, Room 2C-282  fax:    (908)582-3340
Murray Hill, NJ  07974            web: http://www.cs.bell-labs.com/~jmc

More information about the R-help mailing list