Updates a cohort by applying a new query.
cb_apply_query(cohort, query, keep_query = TRUE)
A cohort object. (Required)
See constructor function cb_create_cohort
or cb_load_cohort
A phenotype query defined using the phenotype
function and logic operators (see example below)
If True, combines the newly supplied query with the pre-existing query. Otherwise, pre-existing query is overwritten. (Default: TRUE)
The updated cohort object.
if (FALSE) {
A <- phenotype(id = 13, from = "2016-01-21", to = "2017-02-13")
B <- phenotype(id = 4, value = "Cancer")
A_not_B <- A & !B
my_cohort <- cb_load_cohort(cohort_id = "612f37a57673ed0ddeaf1333", cb_version = "v2")
my_cohort <- cb_apply_query(my_cohort, query = A_not_B, keep_query = F)
}