Ryan C. Thompson
Ryan C. Thompson

Reputation: 42010

How can I find out all the methods defined for a class in R?

In R, I want to get an idea of what I can do with a particular class (specifically, the "Mart" class from the "biomaRt" package in BioConductor). I would like to see all the methods that are defined for this class. Is there a way to do this?

Note: The methods function does not do what I want. That function lists all the classes for which a specific method is defined, not all the methods defined for a class.

Upvotes: 11

Views: 1720

Answers (2)

Joshua Ulrich
Joshua Ulrich

Reputation: 176648

Ah, but methods does do what you want. Read ?methods carefully and you will see the class= argument is what you're looking for.

require(zoo)
methods(class="zoo")

S4 classes are similar, but you need to use showMethods instead.

require(timeSeries)
showMethods(classes="timeSeries")

Upvotes: 16

Greg Snow
Greg Snow

Reputation: 49640

If your class is an S3 class then you use the methods function, but specify the class argument.

If it is an S4 class then use showMethods.

Upvotes: 2

Related Questions