I have some computations that involve calculations with very large numbers, and understand that the package gmp allows handling of arbitrarily large numbers. However, if I try to use the numbers in a tibble or plot them, R gives the following errors, even for numbers the size of which R can handle, so I know that the simple size of the number is not the problem:
Error in
[<-.data.frame(*tmp*, unname, value = list(a = as.raw(c(0x03, : replacement element 1 has 3 rows, need 40
and for plotting:
Don't know how to automatically pick scale for object of type bigz. Defaulting to continuous. Error: Aesthetics must be either length 1 or the same as the data (40): x
The following reprex should produce the same errors:
library(tidyverse)
library(gmp)
test <- tibble(a = c(as.bigz("1000000"), as.bigz("1000000"), as.bigz("1000000")))
test <- mutate(test,
b = a + 50000)
I can see that the calculations have in fact worked:
test$b
But get errors when trying to just look at the tibble or plot the numbers:
test
ggplot(data = test) +
geom_point(aes(x = b, y = 1))
I assume the problem is something to do with the class of the bigz, but don't know how to solve it.