[R] S4 class slot type S4 class

Glenn Schultz glennm@chultz @ending from me@com
Mon May 21 06:06:58 CEST 2018


All,

I am considering creating an S4 class whose slots (2) are both S4 classes.  Since an S4 slot can be an S3 class I figure this can be done.  However, the correct syntax of which I am unsure.  Reviewing the docs I have come to the following conclusion:

SetClass('myfoo',
                  slots = (foo1, foo2))

Without a type I believe each slot is .Data.  A get method on the above class slots would return say foo1 which will have all methods and generics belonging to foo1 class.  Is this the correct approach?

Best,
Glenn


More information about the R-help mailing list