recordCohortAttrition {CDMConnector} | R Documentation |
Add attrition reason to a cohort_table object
Description
Update the cohort attrition table with new counts and a reason for attrition.
Usage
recordCohortAttrition(cohort, reason, cohortId = NULL)
record_cohort_attrition(cohort, reason, cohortId = NULL)
Arguments
cohort |
A generated cohort set |
reason |
The reason for attrition as a character string |
cohortId |
Cohort definition id of the cohort you want to update the attrition |
Value
The cohort object with the attributes created or updated.
Examples
## Not run:
library(CDMConnector)
library(dplyr)
con <- DBI::dbConnect(duckdb::duckdb(), eunomia_dir())
cdm <- cdm_from_con(con = con, cdm_schema = "main", write_schema = "main")
cdm <- generateConceptCohortSet(
cdm = cdm, conceptSet = list(pharyngitis = 4112343), name = "new_cohort"
)
settings(cdm$new_cohort)
cohortCount(cdm$new_cohort)
cohortAttrition(cdm$new_cohort)
cdm$new_cohort <- cdm$new_cohort %>%
filter(cohort_start_date >= as.Date("2010-01-01"))
cdm$new_cohort <- updateCohortAttributes(
cohort = cdm$new_cohort, reason = "Only events after 2010"
)
settings(cdm$new_cohort)
cohortCount(cdm$new_cohort)
cohortAttrition(cdm$new_cohort)
## End(Not run)
[Package CDMConnector version 1.5.0 Index]