Hello,
I?m experimenting with ALTREP and was wondering if there is a preferred way to create an ALTREP wrapper vector without using .Internal(wrap_meta(?)), which R CMD check doesn?t like since it uses an .Internal() function.
I was trying to create a factor that used an ALTREP integer, but attempting to set the class and levels attributes always ended up duplicating and materializing the integer vector. Using the wrapper avoided this issue.
Here is my initial ALTREP integer vector:
fc0 <- factor(c("a", "a", "b"))
y <- matter::as.matter(as.integer(fc0))
y <- matter:::as.altrep(y)
.Internal(inspect(y))
@7fb0ce78c0f0 13 INTSXP g0c0 [NAM(7)] matter vector (mode=3, len=3, mem=0)
Here is what I get without a wrapper: