[R] Creating methods

Göran Broström gb @end|ng |rom eh@r@@e
Mon Apr 24 15:07:50 CEST 2023


I am reading Hadley's "Advanced R", Section 13.4.3 
(https://adv-r.hadley.nz/s3.html). It starts

----------------------------------------------------------------
There are two wrinkles to be aware of when you create a new method:

     First, you should only ever write a method if you own the generic 
or the class. R will allow you to define a method even if you don’t, but 
it is exceedingly bad manners. Instead, work with the author of either 
the generic or the class to add the method in their code.
----------------------------------------------------------------

I was stunned when I read it. I write methods all over the place for 
generics like print, summary, plot, etc.

So my question is: Do I "own" those generics, or am I just showing bad 
manners?

Thanks, Göran



More information about the R-help mailing list