Re: [R] Inheritance for S3 classes

2017-08-12 Thread Kym Nitschke
Thanks to everyone who replied to my query. It is much appreciated. Reading Hadley Wickham's book Advanced R and in particular S3 classes reveals that a class needs to be written allowing inhertinance (by passing the subclass parameter as an argument) and its methods written carefully to functio

Re: [R] Inheritance for S3 classes

2017-08-08 Thread Hadley Wickham
You might find http://adv-r.hadley.nz/s3.html to be helpful (in particular, http://adv-r.hadley.nz/s3.html#constructors-1, gives my advice about subclass constructors) Hadley On Mon, Aug 7, 2017 at 7:06 PM, Kym Nitschke wrote: > Hi R Users, > > I am relatively new to programming in R … so I apol

Re: [R] Inheritance for S3 classes

2017-08-08 Thread Jeff Newmiller
The direct question seemed to be how to pass many optional parameters through, which seems obvious once you know it but the OP might not have seen it yet... f1 <- function( x, y=1, z=2 ) { x*y + z } f2 <- function( x, ... ) { x <- x + 1 f1( x, ... ) } f2( 2, y=3 ) -- Sent from my phone.

Re: [R] Inheritance for S3 classes

2017-08-07 Thread Bert Gunter
The S3 class model isn't really a class model. It's more a way of overloading functions. So it's rather simple, and there's less there than you might be expecting. I always thought the "Object Oriented Programming" chapter of the R language definition manual that ships with R was a very good treatm