[Rcpp-devel] appearance of matrix returned from Rcpp

Jack Wasey jack at jackwasey.com
Sat Feb 14 13:26:11 CET 2015


I figured it out: attribute is called "dimnames" not ".Dimnames".

> .Internal(inspect(rmat))
@34d39b0 10 LGLSXP g0c2 [MARK,NAM(2),ATT] (len=4, tl=0) 1,1,0,0
ATTRIB:
  @32b8228 02 LISTSXP g0c0 [MARK]
    TAG: @e83798 01 SYMSXP g1c0 [MARK,LCK,gp=0x4000] "dim" (has value)
    @33d78c8 13 INTSXP g0c1 [MARK,NAM(2)] (len=2, tl=0) 2,2
    TAG: @e83808 01 SYMSXP g1c0 [MARK,LCK,gp=0x4000] "dimnames" (has value)
    @34d3978 19 VECSXP g0c2 [MARK,NAM(2)] (len=2, tl=0)
      @34d3a20 16 STRSXP g0c2 [MARK,NAM(2)] (len=2, tl=0)
	@103d408 09 CHARSXP g1c1 [MARK,gp=0x61] [ASCII] [cached] "a"
	@1217678 09 CHARSXP g1c1 [MARK,gp=0x61] [ASCII] [cached] "b"
      @e83b18 00 NILSXP g1c0 [MARK,NAM(2)]
> .Internal(inspect(rcpp_mat))
@34f5f80 10 LGLSXP g0c2 [MARK,NAM(2),ATT] (len=4, tl=0) 1,1,0,0
ATTRIB:
  @32b9100 02 LISTSXP g0c0 [MARK]
    TAG: @e83798 01 SYMSXP g1c0 [MARK,LCK,gp=0x4000] "dim" (has value)
    @33d76e8 13 INTSXP g0c1 [MARK,NAM(2)] (len=2, tl=0) 2,2
    TAG: @1ab0878 01 SYMSXP g0c0 [MARK] ".Dimnames"
    @34f5f48 19 VECSXP g0c2 [MARK] (len=2, tl=0)
      @34f5f10 16 STRSXP g0c2 [MARK] (len=2, tl=0)
	@103d408 09 CHARSXP g1c1 [MARK,gp=0x61] [ASCII] [cached] "a"
	@1217678 09 CHARSXP g1c1 [MARK,gp=0x61] [ASCII] [cached] "b"
      @e83b18 00 NILSXP g1c0 [MARK,NAM(2)]


More information about the Rcpp-devel mailing list