Re: [Rd] Same method for more than one class

2007-03-01 Thread Sean Davis
On Thursday 01 March 2007 06:18, Sean Davis wrote: > On Thursday 01 March 2007 05:47, Gregor Gorjanc wrote: > > Hi, > > > > when defining method (I used length bellow just for the simplicity) for > > myClass (S4 class) I use > > > > setMethod(f="length", signature(x="myClass"), > > def=fu

Re: [Rd] Same method for more than one class

2007-03-01 Thread Gregor Gorjanc
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"

Re: [Rd] Same method for more than one class

2007-03-01 Thread Sean Davis
On Thursday 01 March 2007 05:47, Gregor Gorjanc wrote: > Hi, > > when defining method (I used length bellow just for the simplicity) for > myClass (S4 class) I use > > setMethod(f="length", signature(x="myClass"), > def=function(x) { > cat("works") > }) > > If I have

[Rd] Same method for more than one class

2007-03-01 Thread Gregor Gorjanc
Hi, when defining method (I used length bellow just for the simplicity) for myClass (S4 class) I use setMethod(f="length", signature(x="myClass"), def=function(x) { cat("works") }) If I have myClass1 and myClass2 and mentioned method, which is not the default one,