Reputation: 417
If I have a lubridate interval: "2010-02-20" %--% "2012-03-15"
How may I know if a date, say "2011-01-12"
, is in that range?
I am using lubridate and the tidyverse packages.
Upvotes: 1
Views: 437
Reputation: 2561
library(data.table)
ymd("2011-01-12") %between% c("2010-02-20", "2012-03-15")
library(dplyr)
between(ymd("2011-01-12"), "2010-02-20", "2012-03-15")
Upvotes: 0
Reputation: 7153
ymd("2011-01-12") %within% ("2010-02-20" %--% "2012-03-15")
# [1] TRUE
Upvotes: 4