[Rd] S4 Method Signatures

Dario Strbenac D.Strbenac at garvan.org.au
Fri Sep 3 04:00:14 CEST 2010


Hello,

If the signature of a method defines which generic it implements then I'm confused about why this minimal example I invented won't work :

setGeneric("myFun", function(rs, ...){standardGeneric("myFun")})
setGeneric("myFun", function(cs, ...){standardGeneric("myFun")})

setMethod("myFun", "numeric", function(rs, colour = "Blue")
{
	cat(rs*100, colour)
})

setMethod("myFun", "character", function(cs, colour = "Red")
{
	cat(cs, colour)
})

Thanks for any tips,
                    Dario.

--------------------------------------
Dario Strbenac
Research Assistant
Cancer Epigenetics
Garvan Institute of Medical Research
Darlinghurst NSW 2010
Australia



More information about the R-devel mailing list