Martin Morgan
2012-Oct-04 20:57 UTC
[Rd] identical() fails to compare isS4(<S4 instance>) to TRUE
> setClass("A", "integer")> isS4(new("A")) [1] TRUE > identical(isS4(new("A")), TRUE) [1] FALSE > sessionInfo() R Under development (unstable) (2012-10-04 r60876) Platform: x86_64-unknown-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 [7] LC_PAPER=C LC_NAME=C [9] LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base -- Computational Biology / Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109 Location: Arnold Building M1 B861 Phone: (206) 667-2793
Duncan Murdoch
2012-Oct-04 21:23 UTC
[Rd] identical() fails to compare isS4(<S4 instance>) to TRUE
On 12-10-04 4:57 PM, Martin Morgan wrote:> > > setClass("A", "integer") > > isS4(new("A")) > [1] TRUE > > identical(isS4(new("A")), TRUE) > [1] FALSE > > > sessionInfo() > R Under development (unstable) (2012-10-04 r60876) > Platform: x86_64-unknown-linux-gnu (64-bit) > > locale: > [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C > [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 > [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 > [7] LC_PAPER=C LC_NAME=C > [9] LC_ADDRESS=C LC_TELEPHONE=C > [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C > > attached base packages: > [1] stats graphics grDevices utils datasets methods base >I can confirm this in R-devel, but it doesn't happen in R-patched. In R-devel, isS4 is returning a vector marked as LGLSXP, but containing the value 16, not the usual 1 for TRUE. > .Internal(inspect(isS4(new("A")))) @4bfbed8 10 LGLSXP g0c1 [] (len=1, tl=0) 16 I'm not going to have time to track this down and fix it. Duncan Murdoch
Reasonably Related Threads
- Reference Classes: shortcut like 'isS4' for Ref Classes?
- strange error : isS4(x) in gamm function (mgcv package). Variable in data-frame not recognized???
- S4 class extends "data.frame", getDataPart sees "list"
- S4 method implementation for S3 class
- infinite recursion when printing former S4 objects