Skip to contents

Summarise code use in patient-level data

Usage

summariseConceptCounts(
  cdm,
  conceptId = NULL,
  countBy = c("record", "person"),
  concept = TRUE,
  year = FALSE,
  sex = FALSE,
  ageGroup = NULL
)

Arguments

cdm

A cdm object

conceptId

List of concept IDs to summarise. If NULL, all concepts from the concept table will be used

countBy

Either "record" for record-level counts or "person" for person-level counts

concept

TRUE or FALSE. If TRUE code use will be summarised by concept.

year

TRUE or FALSE. If TRUE code use will be summarised by year.

sex

TRUE or FALSE. If TRUE code use will be summarised by sex.

ageGroup

If not NULL, a list of ageGroup vectors of length two. Code use will be thus summarised by age groups.

Value

A tibble with results overall and, if specified, by strata

Examples

if (FALSE) { # \dontrun{
con <- DBI::dbConnect(duckdb::duckdb(),
                      dbdir = CDMConnector::eunomia_dir())
cdm <- CDMConnector::cdm_from_con(con,
                                  cdm_schem = "main",
                                  write_schema = "main")
acetaminophen <- c(1125315,  1127433, 40229134,
40231925, 40162522, 19133768,  1127078)
poliovirus_vaccine <- c(40213160)
cs <- list(acetaminophen = acetaminophen,
          poliovirus_vaccine = poliovirus_vaccine)
results <- summariseConceptCounts(cdm, conceptId = cs)
results
PatientProfiles::mockDisconnect(cdm)
} # }