From pdalgd at gmail.com  Thu Mar 21 14:52:01 2013
From: pdalgd at gmail.com (peter dalgaard)
Date: Thu, 21 Mar 2013 14:52:01 +0100
Subject: [Rd] Deprecating partial matching in $.data.frame
In-Reply-To: <514AC40E.2080808@gmail.com>
References: <A0DE2631-213D-4DB2-A952-5DBFA7A7F14C@gmail.com>
	<E66794E69CFDE04D9A70842786030B931B918849@PA-MBX04.na.tibco.com>
	<A3631670-5E8D-48DC-9868-8C9EE8852FE6@gmail.com>
	<CABdHhvHdHnOEyS+MKmwKTQpYp=zsfB84QDND-LRo2Sf4DXrRXA@mail.gmail.com>
	<514AC40E.2080808@gmail.com>
Message-ID: <9966F1D2-A672-4017-B59D-C05BC86DB603@gmail.com>


On Mar 21, 2013, at 09:25 , Rainer M Krug wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On 20/03/13 17:58, Hadley Wickham wrote:
>> On Wed, Mar 20, 2013 at 11:26 AM, peter dalgaard <pdalgd at gmail.com> wrote:
>>> 
>>> On Mar 20, 2013, at 16:59 , William Dunlap wrote:
>>> 
>>>> Will you be doing the same for attribute names?
>>> 
>>> Not at this point.
>> 
>> It would be really nice to have consistent behaviour across argument names, attributes, lists 
>> and data frames, at least for R CMD check.
> 
> I agree with Hadley that consistency is quite important. This is especially true for data.frames
> and lists, as this concerns the data itself, and not names or attributes of the data.

Well, maybe consistency is important, but partial matching never worked for $-extraction in environments, so the current change could be considered mainly a nudge of data frames in the direction of environments. After all, both can be thought of as collections of named objects.

General lists are a somewhat different issue. They often, formally or informally, represent classed objects with a defined set of names, typically obtained as return values from functions. Since the names are known, people will have used the expedient of abbreviating them. This can happen with data frames as well, but less commonly, since it is in general unsafe to rely on column names being uniquely defined by any particular prefix.

I.e., deprecating partial matching for lists opens a rather larger can of worms, and might require more extensive code revisions. Also, the performance hit of a runtime check for partial matching might be more important for lists than it is for data frames. It could be worth it to implement an R CMD check warning as you suggest, but perhaps not just now. 

-Peter

-- 
Peter Dalgaard, Professor
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com



[Rd] Deprecating partial matching in $.data.frame
peter dalgaard