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
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
2 matches
Mail list logo