summariseCodeUse: Summarise code use in patient-level data

View source: R/summariseCodeUse.R

summariseCodeUseR Documentation

Summarise code use in patient-level data

Description

Summarise code use in patient-level data

Usage

summariseCodeUse(
  x,
  cdm,
  countBy = c("record", "person"),
  byConcept = TRUE,
  byYear = FALSE,
  bySex = FALSE,
  ageGroup = NULL,
  minCellCount = 5
)

Arguments

x

List of concept IDs

cdm

cdm_reference via CDMConnector::cdm_from_con()

countBy

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

byConcept

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

byYear

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

bySex

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

ageGroup

If not NULL, a list of ageGroup vectors of length two.

minCellCount

The minimum number of counts to reported, below which results will be suppressed. If 0, all results will be reported.

Value

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

Examples

## Not run: 
con <- DBI::dbConnect(duckdb::duckdb(),
                      dbdir = CDMConnector::eunomia_dir())
cdm <- CDMConnector::cdm_from_con(con,
                                  cdm_schem = "main",
                                  write_schema = "main")
acetiminophen <- c(1125315,  1127433, 40229134,
40231925, 40162522, 19133768,  1127078)
poliovirus_vaccine <- c(40213160)
cs <- list(acetiminophen = acetiminophen,
          poliovirus_vaccine = poliovirus_vaccine)
results <- summariseCodeUse(cs,cdm = cdm)
results
CDMConnector::cdmDisconnect(cdm)

## End(Not run)


oxford-pharmacoepi/CodelistGenerator documentation built on April 12, 2024, 9:30 a.m.