Dear List, I am currently trying to use methods from other classes to avoid code duplication (my settings are bit complicated, inheritance is not completely giving what I want). What I would like to do is to be able to "get the function in the method" to use it elsewhere... I tried the following, but apparently it does not work, any pointer ? setMethod("f", signature("B"), getMethod("f", signature="A"), where=where) Thanks, Laurent
Hi Laurent, what about something like setMethod("f", signature("B"), definition=function(obj){ f(as(obj, "A") }, where=where) Cheers Michael -- Michael T. Mader Institute for Bioinformatics/MIPS, GSF Ingolstaedter Landstrasse 1 D-80937 Neuherberg 0049-89-3187-3576 In statistics, some people worry about not seeing the forest for the trees. I like to look at the bark. (C. R. Blyth, 1967)
On Sun, 9 Mar 2003, Michael Mader wrote:> Hi Laurent, > > what about something like > > setMethod("f", signature("B"), > definition=function(obj){ > f(as(obj, "A") > }, > where=where) > > > > Cheers > > Michael >May not be what you want if the method for "A" calls generics for which the class of the original obj would be more relevant. luke -- Luke Tierney University of Iowa Phone: 319-335-3386 Department of Statistics and Fax: 319-335-3017 Actuarial Science 241 Schaeffer Hall email: luke at stat.uiowa.edu Iowa City, IA 52242 WWW: http://www.stat.uiowa.edu