[R] Inheritance for S3 classes
Kym Nitschke
kym.nitschke at icloud.com
Tue Aug 8 02:06:50 CEST 2017
Hi R Users,
I am relatively new to programming in R … so I apologise if my questions appear ‘dumb’.
I am using a package that defines a number of S3 classes. I want to create an S3 child class of one of these classes. The parent class has a contractor with many arguments. I have been having difficulty writing the child class contractor. I have been unable to find a good reference in the internet for writing S3 classes. What I have been able to find out so far is that the child class constructor should call the parent class constructor … which in this case requires passing the argument list with a variable number of arguments (i.e. there are a number of optional arguments) from the child to the parent.
So my first question is … is there an easy way to do this? The match.call function will return a call object .. however the attributes function when used on the call object returns a ‘NULL’.
My second question is … can any one recommend a good reference for object oriented programming in R which includes a comprehensive discussion of the S3 class model?
Thanks
Regards,
Kym
More information about the R-help
mailing list