Skip to content
Prev 41901 / 63424 Next

Confused about NAMED

On Nov 24, 2011, at 8:05 AM, Matthew Dowle wrote:

            
Yes, because attr(x,y) <- z is the same as

`*tmp*` <- x
x <- `attr<-`(`*tmp*`, y, z)
rm(`*tmp*`)

so there are two references to the data frame: one in DF and one in `*tmp*`. It is the first line that causes the NAMED bump. And, yes, it's real:
[1] "*tmp*" "f<-"   "x"    

You could skip that by using the function directly (I don't think it's recommended, though):
@1028c82f8 19 VECSXP g0c1 [NAM(1),ATT] (len=1, tl=0)
  @1028c8268 14 REALSXP g0c1 [] (len=1, tl=0) 1
ATTRIB:
  @100b6e748 02 LISTSXP g0c0 [] 
    TAG: @100843878 01 SYMSXP g0c0 [MARK,gp=0x4000] "names"
    @1028c82c8 16 STRSXP g0c1 [] (len=1, tl=0)
      @1009cd388 09 CHARSXP g0c1 [MARK,gp=0x21] "a"
@1028c82f8 19 VECSXP g0c1 [NAM(1),ATT] (len=1, tl=0)
  @1028c8268 14 REALSXP g0c1 [] (len=1, tl=0) 1
ATTRIB:
  @100b6e748 02 LISTSXP g0c0 [] 
    TAG: @100843878 01 SYMSXP g0c0 [MARK,gp=0x4000] "names"
    @1028c8178 16 STRSXP g0c1 [NAM(1)] (len=1, tl=0)
      @100967af8 09 CHARSXP g0c1 [MARK,gp=0x20] "b"
@1028c82f8 19 VECSXP g0c1 [NAM(1),ATT] (len=1, tl=0)
  @1028c8268 14 REALSXP g0c1 [] (len=1, tl=0) 1
ATTRIB:
  @100b6e748 02 LISTSXP g0c0 [] 
    TAG: @100843878 01 SYMSXP g0c0 [MARK,gp=0x4000] "names"
    @1028c8178 16 STRSXP g0c1 [NAM(1)] (len=1, tl=0)
      @100967af8 09 CHARSXP g0c1 [MARK,gp=0x20] "b"

Cheers,
Simon