-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
does padr has a maximum limit on year? #51
Comments
Thank you for informing me. It honestly never occurred to me to check so far in the future. I am not sure if this is a |
I was also having this problem. I chased it down to |
Thanks for your digging, hope to schedule some time for maintenance soon to look further into it. |
Looked into it, it is indeed the year 2038 problem. Meaning that when using POSIXt there is integer overflow from a moment in this year. Alas, research seemed to show there is no universal fix for 32bit machines. Switching to int64 would result in the package only working on 64bit machines, which I am reluctant to do. For the moment I tend towards an informed error and leaving the work around for the user. |
These are the unit tests that should pass once the problem is resolved. a <- as.numeric(ymd_h(c("20380601 00", "20390601 00")))
b <- as.numeric(ymd_h(c("20380101 00", "20390101 00", "20400101 00")))
test_that("round_down_core works after 2038 in posix", {
expect_equal(round_down_core(a, b), b[1:2])
})
test_that("round_down_core_prev works after 2038 in posix", {
expect_equal(round_down_core_prev(a, b), b[1:2])
})
test_that("round_up_core works after 2038 in posix", {
expect_equal(round_up_core(a, b), b[2:3])
})
test_that("round_down_core_prev works after 2038 in posix", {
expect_equal(round_up_core_prev(a, b), b[2:3])
}) |
Thanks for looking into it. Yeah at least with an informative error people would understand what has gone wrong so it a good idea at least in the short term |
It seems that padr has a maximum limit on year which can be processed.
Some datasets, like the MIMICIII database have datetimes shifted in the future randomly. So some years are set in 2100 for example. If the year is greater than 20 from the current year, then padr cannot thicken.
For now it seems that I can subtract year since it's not relevant to my analysis.
If I try to thicken the data without changing the year, then I get an error:
Here's some sample data
Change
dyears(63)
todyears(64)
The text was updated successfully, but these errors were encountered: