From ripley at stats.ox.ac.uk  Thu Feb 17 14:13:20 2005
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Thu Feb 17 14:13:28 2005
Subject: [Rd] Subsetting using dimnames on S4 array-based class
In-Reply-To: <1108649023.25464.10.camel@xurelo.azti.local>
References: <200502171119.j1HBImXa002842@hypatia.math.ethz.ch>
	<1108643876.2771.193.camel@xurelo.azti.local>
	<Pine.LNX.4.61.0502171200230.21232@gannet.stats>
	<1108649023.25464.10.camel@xurelo.azti.local>
Message-ID: <Pine.LNX.4.61.0502171310120.21232@gannet.stats>

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,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595


[Rd] Subsetting using dimnames on S4 array-based class
Prof Brian Ripley