From pdalgd at gmail.com  Sun Dec 12 10:49:58 2010
From: pdalgd at gmail.com (peter dalgaard)
Date: Sun, 12 Dec 2010 10:49:58 +0100
Subject: [Rd] 'identical' and the warning "ignoring non-pairlist
	attributes"
In-Reply-To: <4D04706C.4080605@math.ku.dk>
References: <4D0326FB.1030505@math.ku.dk>
	<0BC90576-12DA-4679-B4A7-370DA1643A08@gmail.com>
	<D1EEC8DE-83C8-48F2-81C4-7F0580C3FC27@gmail.com>
	<4D04706C.4080605@math.ku.dk>
Message-ID: <572052D5-340B-420A-B02C-8C828DC470C4@gmail.com>


On Dec 12, 2010, at 07:49 , Niels Richard Hansen wrote:

> Peter, thanks for looking into this. I know very little about the R
> implementation at the level you are talking about. For the record
> it is pretty easy to avoid the warning by checking and _not_
> doing the inefficient subsetting of an empty data frame ...
> 
> - Niels

It's not something that you'd be expected to know about, but this is r-devel and sometimes we think aloud, hoping that it rings a bell with some other reader...

I don't think it is the empty data frame per se that tickles the bug. Rather, it is an issue of having generated so much activity creating character constants that there are nontrivial hash-chains plus maybe the fact that you are using identical() to compare language-level objects. The attributes of the  were 

(gdb) p Rf_PrintValue(ax)
<CHARSXP: "NA.43436">

(gdb) p Rf_PrintValue(ay)
<CHARSXP: "NA.64694">

and the (sub-) objects that were being compared at the time were

(gdb) p Rf_PrintValue(y)
<CHARSXP: "...">

(gdb) p Rf_PrintValue(x)
<CHARSXP: "a">

"a" and "..." are from argument lists of the functions that you are comparing, and I would assume that the "NA.43436" and "NA.64694" come from  rownames of the million-row data frame that you were creating.


(For the uninitiated: a hash table is used for by-name lookup. It works by computing a numerical "hash-index" based on the name, hoping to replace a linear search by a simple indexed lookup. If two or more names have the same hash index, a final linear search through a chained list of names is necessary.) 

-- 
Peter Dalgaard
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] 'identical' and the warning "ignoring non-pairlist attributes"
peter dalgaard