Re: [R] test for existance of a method for given class

2007-11-14 Thread William Valdar
getS3method(f, x, optional=TRUE)) } hasS4method <- function(f, x) { if (is.object(x)) x <- class(x) for (cl in x) { m <- selectMethod(f, signature(object=cl), optional=TRUE) if (!is.null(m)) return (TRUE) } FALSE } Will On Wed, 14 Nov 2007

[R] test for existance of a method for given class

2007-11-14 Thread William Valdar
on of try()ing the function with the object and then catching the error to determine whether it was defined. Thanks, Will =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= Dr William Valdar ++44 (0)1865 287 589 Wellcome Trust Centre