search for: attachattrib

Displaying 1 result from an estimated 1 matches for "attachattrib".

2020 Nov 21
3
Two ALTREP questions
...t(as.matrix(1:6))) .Internal(inspect(structure(1:6, dim = c(2L,3L)))) .Internal(inspect({x <- 1:6;attr(x, "dim") <- c(2L,3L);x})) .Internal(inspect({x <- 1:6;attributes(x)<- list(dim = c(2L,3L));x})) ``` The only way to make an ALTREP matrix is to use the C level function ``` attachAttrib <- inline::cxxfunction( signature(x = "SEXP", attr = "SEXP" ) , ' SET_ATTRIB(x,attr); return(R_NilValue); ') x <- 1:6 attachAttrib(x, pairlist(dim = c(2L, 3L))) .Internal(inspect(x)) ``` Since the matrix, or adding attributes, is a common need for the object opera...