Trying to read an integer of seconds since the epoch directly into a datetime type column without having to convert it after reading. Can't seem to get read_csv, fread or vroom to do this. Anyone have a way? #rstats
4
3
4
I would suspect you cannot as no reader can guess when seeing an `int` that you meant it as a delta relative to epoch. I would just read as `int` (or `numeric`) and convert as shown in the screenshot.
2
4
This solution seems to fail if the values are too large.
1
1
Replying to @dh_slone
A 32-bit integer has a limit on its range, but if you read my reply to @jaredlander you will note I already mentioned `numeric`. Which works fine, obviously. And we also have `int64` in `nanotime` if you want higher-resolution increments.

May 26, 2021 · 8:18 PM UTC

2
3
I just so happen to have a 13-digit timestamp from the epic. So I used awk to divide by 1000 while reading in the file.
1
1
I see now. I was using the default 'int64' which stores the input just fine, but does not play well with anytime (or setattr for that matter). colClasses = "numeric" fixed it just fine. Thanks!