Last active
August 29, 2015 13:56
-
-
Save qoelet/8930719 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# hit a snag time when working with session ids (represented as bigint in a database) | |
df <- read.csv("myData.csv", header=TRUE) # sid is the column | |
" | |
> tail(df, n=1)$sid | |
[1] 2e+18 | |
" | |
# WTF moment | |
" | |
> 2000000002775713071 == 2000000002775713073 | |
[1] TRUE | |
" | |
# Treat as character class | |
df <- read.csv("myData.csv", header=TRUE, colClasses=c("sid"="character")) | |
" | |
> tail(df, n=1)$sid | |
[1] 2000000002775713071 | |
" | |
# If we really needed to keep work with it as an integer (not in this case but...) | |
library(gmp) | |
mySid = as.bigq(tail(df, n=1)$sid, 19) | |
" | |
> mySid = as.bigq(tail(df, n=1)$sid, 19) | |
> mySid | |
Big Rational ('bigq') : | |
[1] 2000000002798018836/19 | |
" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment