bit64 is an R package for vectors of 64-bit integers
Questions tagged [bit64]
21 questions
12
votes
2 answers
Rcpp and int64 NA value
How can I pass an NA value from Rcpp to R in a 64 bit vector?
My first approach would be:
// [[Rcpp::export]]
Rcpp::NumericVector foo() {
Rcpp::NumericVector res(2);
int64_t val = 1234567890123456789;
…

David
- 9,216
- 4
- 45
- 78
10
votes
1 answer
How to convert a data frame of integer64 values to be a matrix?
I have a data frame consisting entirely of integer64 columns that I'd like to convert to be a matrix.
library(bit64)
(dfr <- data.frame(x = as.integer64(10^(9:18))))
## x
## 1 1000000000
## 2 10000000000
## 3 …

Richie Cotton
- 118,240
- 47
- 247
- 360
7
votes
2 answers
Why does min(200, 300) returns 300 for integer64 class
I came across the following result that seems very un-intuitive to me:
library(bit64)
x = as.integer64(200)
y = as.integer64(300)
min(x, y)
integer64
[1] 300
min.integer64(x, y)
integer64
[1] 300
Surely there is something obvious that I do not get…

statquant
- 13,672
- 21
- 91
- 162
5
votes
0 answers
integer64 and Rcpp compatibility
I will need 64 bits integer in my package in a close future. I'm studying the feasibility based on the bit64 package. Basically I plan to have one or more columns in a data.table with an interger64 S3 class and I plan to pass this table to C++…

JRR
- 3,024
- 2
- 13
- 37
5
votes
2 answers
bit64 integers with fst
I have data in a csv containing long integers. I am exchanging this data between csvs and fst files.
For example,
library(bit64)
library(data.table)
library(fst)
library(magrittr)
# Prepare example csvs
DT64_orig <- data.table(x =…

Hugh
- 15,521
- 12
- 57
- 100
4
votes
1 answer
bit64 NA doesn't replicate in data.frame constructor
While constructing a data-frame, columns are replicated if lengths differ.
> data.frame(x = c(1,2), y = NA_integer_)
x y
1 1 NA
2 2 NA
However, when I try to do this with bit64::NA_integer64_, I get an error. Does anyone know what could be…

Shubham Gupta
- 650
- 6
- 18
3
votes
1 answer
Why does as.integer64("") return 0 instead of NA_integer64_?
Given that the base as.integer() coercion of the empty string is NA without warning, as in:
str( as.integer(c('1234','5678','')) ) # int [1:3] 1234 5678 NA -- no warning
I'm struggling to understand why bit64::as.integer64() coerces to zero without…

C8H10N4O2
- 18,312
- 8
- 98
- 134
3
votes
1 answer
R, bit64, problems calculating row mean and standard deviation in data.table
I am trying to work with larger numbers, over 2^32. While I am also using data.table and fread, I do not believe the problem is related to them. I can turn on and off they symptoms without changing data.table or having used fread. My symptoms are…

Greg Makowski
- 33
- 3
3
votes
1 answer
How to wrap data.table::fread in your own package, with bit64 capability?
I have a package containing a function that calls fread from data.table. data.table has the bit64 package in the Suggests field of its DESCRIPTION file, which gives fread the capability to import large integers as
integer64 rather than numeric. I…

Richie Cotton
- 118,240
- 47
- 247
- 360
3
votes
1 answer
big64 - sum() on a vector of NA produces odd results
When using big64 package, summing a vector of NAs to another vector of integers yields an inaccurate result. Depending on whether the NA vector is summed first or last, the results will be either 0 or twice the correct answer, respectively.
Notice…

Ricardo Saporta
- 54,400
- 17
- 144
- 178
2
votes
1 answer
The `%in%` operation is not correct for integer64
The %in% operator is not providing correct output for integer64
x <- bit64::as.integer64("9219348897572232380")
y <- bit64::as.integer64("9221407835133917342")
x == y
# FALSE
x %in% y
# TRUE

Shubham Gupta
- 650
- 6
- 18
1
vote
2 answers
How to get 64-bit integer value of xxhash64 in R
Using the bit64 package, I am trying to create 64-bit integer hashes using xxhash64, similarly to pyspark's pyspark.sql.functions.xxhash64.
With the digest package, I can create the xxhash64 in the form of a string representation of a hex, however I…

Jozef
- 2,617
- 14
- 19
1
vote
1 answer
Return 64 bit integer from purrr::map_*
How do I return a 64-bit integer from purrr::map_*?
Below does not work
library(bit64)
library(tidyverse)
tibble(x=1:3) %>%
mutate(y=map_int(x,~{return(as.integer64(2^55))}))
Error in mutate():
! Problem while computing y =…

Ben Carlson
- 1,053
- 2
- 10
- 18
1
vote
1 answer
fread reads large integers as integer64, which are not upcasted to doubles in case of arithemetic expressions
When a file is read through fread, the columns may be read as integer64 (correctly so), but when these are multiplied with numeric, they are not upcasted to numeric (as in C++ or integers in R). While this is a documented behavior in bit64 package.…

cryptickey
- 169
- 8
1
vote
1 answer
Iterating through an integer 64 array prints incorrect values in R
Do for loop and lapply not inherently support integer64 ?
> x <- as.integer64(c("100000000000", "10000000000000"))
> x
integer64
[1] 100000000000 10000000000000
> for(y in x) {print(y)}
[1] 4.940656e-313
[1] 4.940656e-311
> tmp <- lapply(x,…

cryptickey
- 169
- 8