Created
April 8, 2018 23:53
-
-
Save richgillin/f9f11699ffe7335d0eeccbad75252574 to your computer and use it in GitHub Desktop.
18th birthday anomoly
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
a1 <- as.Date("1985-01-21") | |
a1 <- as.POSIXlt(a1) | |
a1$year <- a1$year+18; a1 | |
## [1] "2003-01-21 UTC" | |
# with lubridate | |
library(lubridate) | |
a2 <- as_date("1985-01-21") | |
a_18 <- a2 + dyears(18); a_18 | |
## [1] "2003-01-17" | |
## Four days difference between r-base (+Fei Teng) and tidyverse. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment