| timeWindowCohorts | R Documentation |
Split cohorts based on time-windows
timeWindowCohorts(
cohort,
window,
cohortId = NULL,
keepOriginalCohorts = TRUE,
name = tableName(cohort)
)
cohort |
A cohort table in a cdm reference. |
window |
A list specifying the time windows (in days) used to split the
cohort. Each element must be a numeric vector of length 2:
|
cohortId |
Vector identifying which cohorts to include (cohort_definition_id or cohort_name). Cohorts not included will be removed from the cohort set. |
keepOriginalCohorts |
If TRUE the original cohorts will be return together with the new ones. If FALSE only the new cohort will be returned. |
name |
Name of the new cohort table created in the cdm object. |
A cohort table
library(CohortConstructor)
cdm <- mockCohortConstructor()
# if "cohort1" contained pregnancy episodes, we can generate trimester-specific
# cohorts with this function
cdm$pregnancy_trimesters <- timeWindowCohorts(
cohort = cdm$cohort1,
window = list(
"trimester_1" = c(0, 90),
"trimester_2" = c(91,180),
"trimester_3" = c(181, Inf)
),
cohortId = NULL,
keepOriginalCohorts = FALSE,
name = "pregnancy_trimesters"
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.