Filtering of datetime data within a time interval. The function finds rows for which date_var is within interval created based on index_date, time_before and time_after.

filter_date_in_ival(
  .data,
  date_var,
  index_date,
  time_before = years(2),
  time_after = days(0)
)

Arguments

date_var
index_date

date or other lubridate variable as reference point around which to search

time_before

the time before the index date what defines the start of filtering interval (lubridate format, e.g years(1), weeks(10), days(20) etc.)

time_after

the time after the index date (default is 0 days) what defines the start of filtering interval (lubridate format, e.g years(1), weeks(10), days(20) etc.)

Value

returns a tibble object with filtered rows

See also

filter_ival_olap_ival for date filtering by different intervals before and after the occurence

Other filter functions: filter_ival_olap_ival()

Examples

if (FALSE) { TODO: x <- 1 }