Skip to content
Prev 58817 / 63424 Next

Invisible names problem

On 22/07/2020 3:29 p.m., Pan Domu wrote:
You can use .Internal(inspect(x1)) and .Internal(inspect(x2)) to see 
that the two objects are not identical:

 > .Internal(inspect(x1))
@1116b7000 14 REALSXP g0c7 [REF(2)] (len=20000, tl=0) 1,2,3,4,1,...
 > .Internal(inspect(x2))
@7f9c77664ce8 14 REALSXP g0c0 [REF(2)]  wrapper [srt=-2147483648,no_na=0]
   @10e7b7000 14 REALSXP g0c7 [REF(6),ATT] (len=20000, tl=0) 1,2,3,4,1,...
   ATTRIB:
     @7f9c77664738 02 LISTSXP g0c0 [REF(1)]
       TAG: @7f9c6c027890 01 SYMSXP g1c0 [MARK,REF(65535),LCK,gp=0x4000] 
"names" (has value)
       @10e3ac000 16 STRSXP g0c7 [REF(65535)] (len=20000, tl=0)
	@7f9c6ab531c8 09 CHARSXP g1c1 [MARK,REF(10066),gp=0x61] [ASCII] 
[cached] "a"
	@7f9c6ae9a678 09 CHARSXP g1c1 [MARK,REF(10013),gp=0x61] [ASCII] 
[cached] "b"
	@7f9c6c0496c0 09 CHARSXP g1c1 [MARK,REF(10568),gp=0x61,ATT] [ASCII] 
[cached] "c"
	@7f9c6ad3df40 09 CHARSXP g1c1 [MARK,REF(10029),gp=0x61,ATT] [ASCII] 
[cached] "d"
	@7f9c6ab531c8 09 CHARSXP g1c1 [MARK,REF(10066),gp=0x61] [ASCII] 
[cached] "a"
	...


It looks as though x2 is a tiny ALTREP object acting as a wrapper on the 
original k[i], but I might be misinterpreting those displays.  I don't 
know how to force ALTREP objects to standard representation: 
unserializing the serialized x2 gives something like x2, not like x1. 
Maybe you want to look at one of the contributed low level packages. 
The stringfish package has a "materialize" function that is advertised 
to convert anything to standard format, but it doesn't change x2.

Duncan Murdoch