Re: [Rd] Dispatch mechanism seems to alter object before calling method on it

2018-05-16 Thread Michael Lawrence
On Wed, May 16, 2018 at 3:45 PM, Hervé Pagès wrote: > On 05/16/2018 01:24 PM, Michael Lawrence wrote: >> >> On Wed, May 16, 2018 at 12:23 PM, Hervé Pagès >> wrote: >>> >>> On 05/16/2018 10:22 AM, Michael Lawrence wrote: Factors and

Re: [Rd] Dispatch mechanism seems to alter object before calling method on it

2018-05-16 Thread Hervé Pagès
On 05/16/2018 01:24 PM, Michael Lawrence wrote: On Wed, May 16, 2018 at 12:23 PM, Hervé Pagès wrote: On 05/16/2018 10:22 AM, Michael Lawrence wrote: Factors and data.frames are not structures, because they must have a class attribute. Just call them "objects". They are

Re: [Rd] Dispatch mechanism seems to alter object before calling method on it

2018-05-16 Thread Michael Lawrence
On Wed, May 16, 2018 at 12:23 PM, Hervé Pagès wrote: > On 05/16/2018 10:22 AM, Michael Lawrence wrote: >> >> Factors and data.frames are not structures, because they must have a >> class attribute. Just call them "objects". They are higher level than >> structures, which in

Re: [Rd] Dispatch mechanism seems to alter object before calling method on it

2018-05-16 Thread Hervé Pagès
On 05/16/2018 10:22 AM, Michael Lawrence wrote: Factors and data.frames are not structures, because they must have a class attribute. Just call them "objects". They are higher level than structures, which in practice just shape data without adding a lot of semantics. Compare getClass("matrix")

Re: [Rd] Dispatch mechanism seems to alter object before calling method on it

2018-05-16 Thread Michael Lawrence
Factors and data.frames are not structures, because they must have a class attribute. Just call them "objects". They are higher level than structures, which in practice just shape data without adding a lot of semantics. Compare getClass("matrix") and getClass("factor"). I agree that inheritance

Re: [Rd] Dispatch mechanism seems to alter object before calling method on it

2018-05-16 Thread Hervé Pagès
On 05/15/2018 09:13 PM, Michael Lawrence wrote: My understanding is that array (or any other structure) does not "simply" inherit from vector, because structures are not vectors in the strictest sense. Basically, once a vector gains attributes, it is a structure, not a vector. The methods

Re: [Rd] Dispatch mechanism seems to alter object before calling method on it

2018-05-15 Thread Michael Lawrence
My understanding is that array (or any other structure) does not "simply" inherit from vector, because structures are not vectors in the strictest sense. Basically, once a vector gains attributes, it is a structure, not a vector. The methods package accommodates this by defining an "is"