Get occurrences of a concepts from AoU for a given cohort
Source:R/aou_pull_concepts.R
aou_pull_concepts.Rd
Get occurrences of a concepts from AoU for a given cohort
Arguments
- cohort
tbl; reference to a table with a column called "person_id", and columns for start_date and end_date
- concepts
num; a vector of concept ids
- start_date
the name of the start_date column in the cohort table (unquoted)
- end_date
the name of the end_date column in the cohort table (unquoted)
- concept_set_name
chr; Name to describe the concept set, used to create an indicator variable
- min_n
dbl; the minimum number of occurrences per person to consider the indicator true
- n
dbl; count the number of occurrences per person (will not include zeros)
- keep_all
lgl; keep columns with information about the concept (e.g., concept name, id, etc.)
- con
the connection object to AoU
- collect
lgl; whether to collect from the database
Examples
if (FALSE) {
# simple example
tobacco <- pull_concepts(cohort, concepts = 1157, start_date = covariate_start_date,
end_date = cohort_start_date, name = "tobacco")
# starting with person table
people <- tbl(con, "cb_search_person") %>%
mutate(start_date = as.Date("1970-01-01"),
end_date = as.Date("2023-05-24"))
dat <- aou_pull_concepts(cohort = people,
concepts = c(725115, 1612146, 1613031),
start_date = start_date,
end_date = end_date, concept_set_name = "CGM",
domains = c("condition", "measurement", "observation", "procedure", "drug", "device"),
keep_all = TRUE)
}