-
-
Save fpcMotif/9b6115a08c95c6b76eec6b4a7aca962c to your computer and use it in GitHub Desktop.
Number of months between two dates
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
| library(lubridate) | |
| dates <- c("2011-01-17", "2009-11-21") | |
| p <- as.period( interval( ymd(dates), Sys.Date() ) ) | |
| year(p)*12 + month(p) | |
| interval(dates, today()) %/% months(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment