Displaying 3 results from an estimated 3 matches for "7fb0ce78c0f0".
2019 Jul 17
2
ALTREP wrappers and factors
...lizing 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:
> fc1 <- structure(y, class="factor", levels=levels(x))
> .Internal(inspect(fc1))
@7fb0cae66408 13 INTSXP g0c2 [OBJ,NAM(2),ATT] (len=3, tl=0) 1,1,2
ATTRIB:
@7fb0ce771868 02 LIST...
2019 Jul 18
0
ALTREP wrappers and factors
...n't think a wrapper can completely solve your
problem. The duplication occurs since your variable y has more than 1
reference number( Please see highlighted), so even you have a wrapper, any
changes on the value of the wrapper still can trigger the duplication.
> .Internal(inspect(y))
> @7fb0ce78c0f0 13 INTSXP g0c0 *[NAM(7)]* matter vector (mode=3, len=3,
> mem=0)
My guess is that *matter:::as.altrep* function assigned the variable *y* to
a local variable so that it increases the reference number. For example:
*This would not cause a duplication*
> > a=c(1,2,3)
> > .Internal(...
2019 Jul 19
2
ALTREP wrappers and factors
...itial 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:
> >
> > > fc1 <- structure(y, class="factor", levels=levels(x))
> > > .Internal(inspect(fc1))
> > @7fb0cae66408 13 INTSXP g0c2 [OBJ,...