[R] showMethods doubt
Ernesto Jardim
ernesto at ipimar.pt
Thu Jun 2 12:06:55 CEST 2005
Hi,
I'm developing in S4 and I wanted to see the methods for a specific
class using showMethods but I didn't succed. Can someone help ? See the
example below.
setClass("myclass",
representation(
name ="character"
)
)
setGeneric("mymeth", function(obj, ...){
standardGeneric("mymeth")
}
)
setMethod("mymeth", signature("myclass"), function(obj){
print(paste("Hi,", obj at name, "and I don't know what to do with
showMethods !"))
}
)
Now if you do:
> myobj <- new("myclass", name="my name is joe")
> mymeth(myobj)
[1] "Hi, my name is joe and I don't know what to do with showMethods !"
So the method is working, let's use showMethods:
> showMethods(classes="myclass")
Function "addNextMethod":
<Empty Methods List>
Function "body<-":
<Empty Methods List>
Function "coerce":
<Empty Methods List>
Function "initialize":
.Object = "myclass"
(inherited from .Object = "ANY")
Function "loadMethod":
<Empty Methods List>
Function "show":
object = "myclass"
(inherited from object = "ANY")
NULL
mymeth does not show on that list, why ?
Regards
EJ
More information about the R-help
mailing list