Re: [Rd] Subsetting using dimnames on S4 array-based class

From: Prof Brian Ripley <>
Date: Fri 18 Feb 2005 - 00:13:20 EST

On Thu, 17 Feb 2005, Iago Mosqueira wrote:

> On Thu, 2005-02-17 at 12:32, Prof Brian Ripley wrote:
>> and you are talking about *names of* dimnames).
> Sorry for the confusion.
>> It `works' for arrays because the definition there (in ?Extract) is not
>> the same as the generic you are using: notice the ... in the definitions,
>> and for arrays it is really "["(x, ..., drop=TRUE) and the names of ...
>> are ignored.
> Thanks. I did realise for arrays the names are ignored, but in the new
> class they are not even accepted.
>> so argument names are ignored for the primitives, but not for S3 methods
>> (and I believe not for S4 methods).
> I am afraid I fail to see then why my example code fails to accept names
> when subsetting. Shouldn't a class that extends "array" inherit this
> behaviour too?

No, it inherits from the S4 pseudo-method for "array", not the primitive. Remember that S4 methods are bolted on to a different system, and bridging the gaps where possible has been very hard work (by John Chambers).

Brian D. Ripley,        
Professor of Applied Statistics,
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________ mailing list
Received on Thu Feb 17 23:24:49 2005

This archive was generated by hypermail 2.1.8 : Thu 17 Feb 2005 - 23:29:45 EST