From murdoch.duncan at gmail.com  Mon Apr 11 19:34:05 2011
From: murdoch.duncan at gmail.com (Duncan Murdoch)
Date: Mon, 11 Apr 2011 13:34:05 -0400
Subject: [Rd] sort.int(S3object) strips class but not the is.object flag
In-Reply-To: <77EB52C6DD32BA4D87471DCD70C8D700041B2FC4@NA-PA-VBE03.na.tibco.com>
References: <77EB52C6DD32BA4D87471DCD70C8D700041B2FC4@NA-PA-VBE03.na.tibco.com>
Message-ID: <4DA33B8D.60006@gmail.com>

On 11/04/2011 1:10 PM, William Dunlap wrote:
> If x has an S3 class then sort.int(x) returns a value
> without an S3 class but which has the is.object flag set,
> which, I think, causes identical() give a false/misleading
> report:

I think your analysis is correct.  It's too late for 2.13.0, but I'll 
fix this in R-devel, and backport it to 2.13.0-patched.

Duncan Murdoch

>
>    >  x<- structure(1:3, class="unrecognizedClass")
>    >  y<- sort.int(x)
>    >  t<- 1:3
>    >  identical(y, t) # expect TRUE
>    [1] FALSE
>    >  identical(as.vector(y), as.vector(t)) # expect TRUE
>    [1] FALSE
>    >  dput(y)
>    1:3
>    >  dput(t)
>    1:3
>    >  class(y)
>    [1] "integer"
>    >  class(t)
>    [1] "integer"
>    >  is.object(y)
>    [1] TRUE
>    >  is.object(t)
>    [1] FALSE
>
> The files made by
>    save(t, file="t.Rdata", compress=FALSE)
>    save(y, file="y.Rdata", compress=FALSE)
> differ in 2 places, where the first is presumably
> the name of the object:
>    % cmp -l y.Rdata t.Rdata
>    36 171 164
>    39   1   0
> (The problem persists after a save/load cycle.)
>
> This is on R 2.12.2 on Linux.  Sorry, I don't have 2.13.0
> yet installed.
>
> Bill Dunlap
> Spotfire, TIBCO Software
> wdunlap tibco.com
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



[Rd] sort.int(S3object) strips class but not the is.object flag
Duncan Murdoch