Message-ID: <CAGAA5befGSA_LBTw_zUCauawg2+-AjNrB0iG8puhtqPoF=iEuQ@mail.gmail.com>
Date: 2020-01-27T00:32:53Z
From: Martin Møller Skarbiniks Pedersen
Subject: How to store something not simple in a vector?
Hi,
Sorry for the HTML version in the buttom of this email.
I don't think it is possible to post using gmail without a
html-version in the end.
Anyway to my problem:
I am trying to create a vector to store objects create with gmp::as.bigq().
My first attempt:
library(gmp)
V <- vector("bigq", 100)
My second attempt after understand that I probably need to
examine a bigq with typeof()
library(gmp)
V <- vector(typeof(as.bigq(1)), 100) # typeof(as.bigq(1)) is raw
V[[100]] <- as.bigq(1,2)
With the error message:
Error in V[[100]] <- as.bigq(1, 2) :
more elements supplied than there are to replace
And now I understand that bigq is stored as raw-bytes and it
is has a length more than 1. Actually:
length(as.raw(as.bitq(1,2))
[1] 16
Please advise.
Thanks a lot.
/Martin M. S. Pedersen