Reputation: 14614
I have a column of integer64
and would like to use that as the key, only it does not work as shown below: the value gives NA
.
This works
s = data.table(id=1000000107000008595, value=10)
setkey(s, id)
s[J(1000000107000008595)]
# id value
# 1: 1.00000e+18 10
This does not work
s = data.table(id=as.integer64(1000000107000008595), value=10)
setkey(s, id)
s[J(1000000107000008595)]
# id value
# 1: 1.00000e+18 NA # <- NA is the problem
Upvotes: 0
Views: 165
Reputation: 3253
What version of R. packages are you using? I just tried this:
library(bit64)
library(data.table)
s = data.table(id=1000000107000008595, value=10)
setkey(s, id)
s[J(1000000107000008595)]
s = data.table(id=as.integer64(1000000107000008595), value=10)
setkey(s, id)
s[J(1000000107000008595)]
and it gives me
> s = data.table(id=1000000107000008595, value=10)
> setkey(s, id)
> s[J(1000000107000008595)]
id value
1: 1e+18 10
>
> s = data.table(id=as.integer64(1000000107000008595), value=10)
> setkey(s, id)
> s[J(1000000107000008595)]
id value
1: 1000000107000008576 10
Im on
> version$version.string
[1] "R version 3.2.2 (2015-08-14)"
and sessionInfo()
says
other attached packages:
[1] data.table_1.9.6 bit64_0.9-5 bit_1.1-12
Upvotes: 3