From gregor.gorjanc at bfro.uni-lj.si  Thu Mar  1 12:36:27 2007
From: gregor.gorjanc at bfro.uni-lj.si (Gregor Gorjanc)
Date: Thu, 01 Mar 2007 12:36:27 +0100
Subject: [Rd] Same method for more than one class
In-Reply-To: <200703010618.11599.sdavis2@mail.nih.gov>
References: <45E6AF4E.9050107@bfro.uni-lj.si>
	<200703010618.11599.sdavis2@mail.nih.gov>
Message-ID: <45E6BABB.2070709@bfro.uni-lj.si>

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



[Rd] Same method for more than one class
Gregor Gorjanc