Sean Davis wrote:
...
> 
> Could you do:
> 
> catFun <- function(x) {
>   cat("Works")
> }
> setMethod(f="length", signature(x="myClass1"),def=catFun)
> setMethod(f="length", signature(x="myClass2"),def=catFun)

Yep, that is what I wanted.

setMethod(f="length", signature(x=c("myClass1", "myClass2"))

would be shorter, but your proposal is also OK.

Thank you again, Gregor

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to