Here, the top answers describes a good way to make a method dispatch on both S3 and S4 objects. However, that way only works when both methods have the same signature.
Is there a way to create an S4 method for median
with a different signature?
For example, the following does not work:
setGeneric("median")
median.Foo <- function(arg1, arg2, ...){}
setMethod("median", "Foo", median.Foo)
When installing the libary, there is an error saying that formal arguments are missing, x
and na.rm
, which are the arguments for the original median function.
I would like to avoid the solution at the top of author's post.