requirePriorDrugWashout {DrugUtilisation} | R Documentation |
Filter the cohort table keeping only the cohort records for which the required amount of time has passed since the last cohort entry ended for that individual.
requirePriorDrugWashout(
cohort,
days,
cohortId = NULL,
name = omopgenerics::tableName(cohort)
)
cohort |
A cohort table in a cdm reference. |
days |
The number of days required to have passed since the last cohort
record finished. Any records with fewer days than this will be dropped. Note
that setting days to Inf will lead to the same result as that from using the
|
cohortId |
IDs of the cohorts to modify. The default is NULL meaning all cohorts will be used; otherwise, only the specified cohorts will be modified, and the rest will remain unchanged. |
name |
Name of the table with the filtered cohort records. The default name is the original cohort name, where the original table will be overwritten. |
The cohort table having applied the washout requirement.
library(DrugUtilisation)
library(dplyr)
cdm <- mockDrugUtilisation()
cdm$cohort1 <- cdm$cohort1 |>
requirePriorDrugWashout(days = 90)
attrition(cdm$cohort1) |> glimpse()