'identical' and the warning "ignoring non-pairlist attributes"
On Dec 11, 2010, at 11:23 , peter dalgaard wrote:
On Dec 11, 2010, at 08:23 , Niels Richard Hansen wrote:
Dear R developers Using the 'foreach' package I encounter warnings like Warning message: In identical(.combine, cbind) : ignoring non-pairlist attributes Warnings appear once in a new R-session when I run a particular piece of code - and not again. I understand from the source code of 'identical' that the function checks and believes that .combine and cbind have non-pairlist attributes, but I don't understand how this can be the case I have produced the following minimal example data.frame()[rep(1,1e6), ] library(foreach) identical(foreach:::defcombine, cbind) resulting in [1] FALSE Warning message: In identical(foreach:::defcombine, cbind) : ignoring non-pairlist attributes The warning is not related to the foreach package it seems. I get the same kind of warning with e.g. identical(spatial:::trmat, cbind) in a new R-session. Many other functions I have tried do, however, not result in the warning. The warning depends on the supposedly completely unrelated data frame operation. It seems also to be related to the fact that the data frame is empty and I extract a large number of columns out of this empty data frame. I would highly appreciate help on this to get rid of the warning in my own package.
Hm, I think you might have tickled a buglet here. I can debug it down to a comparison of two CHARSXPs, both having CHARSXP attributes. I'm a getting a little rusty on debugging at that level, but I don't think CHARSXPs are supposed to _have_ attributes in any meaningful context, so perhaps identical() just shouldn't check. On the other hand, it could also be the sign of a memory overrun in the preceding memory-intensive operation.
Robert Gentleman pointed out offlist that attributes of CHARSXP are being used for cacheing and hashing, so skipping the comparison is what makes sense. I have fixed this for R-devel now (tampering with 2.12.1 RC for this sort of reason is probably best avoided).
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