[R] serialize does not work as expected

Jeff King @zwj|08 @end|ng |rom gm@||@com
Sun Aug 30 07:28:55 CEST 2020


compact sequences are actually an ALTREP object. I do not know if there is
any standard way to do it, but here is a trick for what you want.

```
> x <- 1:3
> .Internal(inspect(x))
@0x00000196bed8dd78 13 INTSXP g0c0 [NAM(7)]  1 : 3 (compact)
> x[1] <- x[1]
> .Internal(inspect(x))
@0x00000196bef90b60 13 INTSXP g0c2 [NAM(7)] (len=3, tl=0) 1,2,3
```

Best,
Jiefei

On Sat, Aug 29, 2020 at 1:10 PM Sigbert Klinke <sigbert using wiwi.hu-berlin.de>
wrote:

> Hi,
>
> is there in R a way to "normalize" a vector from
> compact_intseq/compact_realseq to a "normal" vector?
>
> Sigbert
>
> Am 29.08.20 um 18:13 schrieb Duncan Murdoch:
> > Element 1
> > A
> > 3
> > 262146
> > 197888
> > 5
> > UTF-8
> > 238
> > 2
> > 1
> > 262153
> > 14
> > compact_intseq
> > 2
> > 1
> > 262153
> > 4
> > base
> > 2
> > 13
> > 1
> > 13
> > 254
> > 14
> > 3
> > 3
> > 1
> > 1
> > 254
> >
> > Element 2
> > A
> > 3
> > 262146
> > 197888
> > 5
> > UTF-8
> > 238
> > 2
> > 1
> > 262153
> > 15
> > compact_realseq
> > 2
> > 1
> > 262153
> > 4
> > base
> > 2
> > 13
> > 1
> > 14
> > 254
> > 14
> > 3
> > 3
> > 1
> > 1
> > 254
> >
> > Element 3
> > A
> > 3
> > 262146
> > 197888
> > 5
> > UTF-8
> > 14
> > 3
> > 1
> > 2
> > 3
>
>
> --
> https://hu.berlin/sk
> https://hu.berlin/mmstat3
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list