powered by
Filter the cohort table keeping only the cohort records for which the specified index date is within a specified date range.
requireDrugInDateRange( cohort, dateRange, indexDate = "cohort_start_date", cohortId = NULL, name = omopgenerics::tableName(cohort) )
The cohort table having applied the date requirement.
A cohort_table object.
Date interval to consider. Any records with the index date outside of this range will be dropped.
The column containing the date that will be checked against the date range.
A cohort definition id to restrict by. If NULL, all cohorts will be included.
Name of the new cohort table, it must be a length 1 character vector.
# \donttest{ cdm <- mockDrugUtilisation() cdm$cohort1 <- cdm$cohort1 |> requireDrugInDateRange( dateRange = as.Date(c("2020-01-01", NA)) ) attrition(cdm$cohort1) |> dplyr::glimpse() # }
Run the code above in your browser using DataLab