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))
@0x0196bed8dd78 13 INTSXP g0c0 [NAM(7)] 1 : 3 (compact)
> x[1] <- x[1]
> .Internal(inspect(x))
@0x0196bef90b6
On 29/08/2020 1:10 p.m., Sigbert Klinke wrote:
Hi,
is there in R a way to "normalize" a vector from
compact_intseq/compact_realseq to a "normal" vector?
I don't know if there's a function specifically designed to do that, but
as Henrik proposed, this works:
l_normalized <- unserialize(seri
For some reason l[[2]] is serialized as a 'compact_realseq' and l[3]]
is not. They both unserialize to the same thing. On Windows I get:
> lapply(l, function(x)rawToChar(serialize(x, connection=NULL, ascii=TRUE)))
[[1]]
[1]
"A\n3\n262146\n197888\n6\nCP1252\n238\n2\n1\n262153\n14\ncompact_intseq
Does serialize(..., version = 2L) do what you want?
/Henrik
On Sat, Aug 29, 2020 at 10:10 AM Sigbert Klinke
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:
> >
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
26
On 29/08/2020 11:34 a.m., Sigbert Klinke wrote:
Hi,
if I create a list with
l <- list(1:3, as.numeric(1:3), c(1,2,3))
and applying
lapply(l, 'class')
lapply(l, 'mode')
lapply(l, 'storage.mode')
lapply(l, 'typeof')
identical(l[[2]], l[[3]])
then I would believe that as,numeric(1:3) and c(1,2,
Did you really conclude from looking at class that they were identical?
Numeric mode sometimes makes it hard to distinguish integers from doubles, but
they are different.
On August 29, 2020 8:34:29 AM PDT, Sigbert Klinke
wrote:
>Hi,
>
>if I create a list with
>
>l <- list(1:3, as.numeric(1:3),
Hi,
if I create a list with
l <- list(1:3, as.numeric(1:3), c(1,2,3))
and applying
lapply(l, 'class')
lapply(l, 'mode')
lapply(l, 'storage.mode')
lapply(l, 'typeof')
identical(l[[2]], l[[3]])
then I would believe that as,numeric(1:3) and c(1,2,3) are identical
objects. However,
lapply(l, s
8 matches
Mail list logo