bit64

How to convert a data frame of integer64 values to be a matrix?

巧了我就是萌 提交于 2019-12-29 07:34:12
问题 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 100000000000 ## 4 1000000000000 ## 5 10000000000000 ## 6 100000000000000 ## 7 1000000000000000 ## 8 10000000000000000 ## 9 100000000000000000 ## 10 1000000000000000000 Unfortunately, as.matrix doesn't give the correct answer. (m <- as.matrix(dfr)) ## x ## [1,] 4.940656e-315 ## [2,] 4

Why does as.integer64(“”) return 0 instead of NA_integer64_?

自作多情 提交于 2019-12-12 12:35:14
问题 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 warning: library('bit64') str( as.integer64(c('1234','5678','')) ) # integer64 [1:3] 1234 5678 0 -- no warning What's even stranger is to compare: str( as.integer(c('1234','5678','', 'Help me Stack Overflow')) ) # int [1:4] 1234 5678 NA NA --

integer64 and Rcpp compatibility

十年热恋 提交于 2019-12-07 08:28:47
问题 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++ functions using Rcpp. The following nanotime example from Rcpp gallery explains clearly how a vector of 64 bits int is built upon a vector of double and explain how to create an integer64 object from C++ to R. I'm now wondering how to deal with an

integer64 and Rcpp compatibility

丶灬走出姿态 提交于 2019-12-05 19:45:14
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++ functions using Rcpp. The following nanotime example from Rcpp gallery explains clearly how a vector of 64 bits int is built upon a vector of double and explain how to create an integer64 object from C++ to R. I'm now wondering how to deal with an interger64 from R to C++. I guess I can invert the principle. void useInt64(NumericVector v) { double len =

How to convert a data frame of integer64 values to be a matrix?

﹥>﹥吖頭↗ 提交于 2019-11-29 10:00:40
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 100000000000 ## 4 1000000000000 ## 5 10000000000000 ## 6 100000000000000 ## 7 1000000000000000 ## 8 10000000000000000 ## 9 100000000000000000 ## 10 1000000000000000000 Unfortunately, as.matrix doesn't give the correct answer. (m <- as.matrix(dfr)) ## x ## [1,] 4.940656e-315 ## [2,] 4.940656e-314 ## [3,] 4.940656e-313 ## [4,] 4.940656e-312 ## [5,] 4.940656e-311 ## [6,] 4.940656e-310 ## [7,