Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the list of class that have a common S4 superclass in R

In R, how do I get the list of subclass of a S4 superclass?

I found showClass("mySuperClass",complete=FALSE) but it only prints the result. I would like to store it in a vector to use it.

like image 738
RockScience Avatar asked Jan 16 '12 09:01

RockScience


1 Answers

Discover the class of a class definition (the class definition is itself an S4 class!)

cls = getClass("MySuperClass")
class(cls)
class?classRepresentation

and, with a little exploring, arrive at

names(cls@subclasses)
like image 142
Martin Morgan Avatar answered Oct 23 '22 11:10

Martin Morgan