Skip to contents

Summarise concept use in patient-level data

Usage

summariseConceptIdCounts(
  cdm,
  omopTableName,
  countBy = "record",
  year = FALSE,
  sex = FALSE,
  ageGroup = NULL,
  sample = NULL,
  dateRange = NULL
)

Arguments

cdm

A cdm object

omopTableName

A character vector of the names of the tables to summarise in the cdm object.

countBy

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

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

A list of ageGroup vectors of length two. Code use will be thus summarised by age groups.

sample

An integer to sample the tables to only that number of records. If NULL no sample is done.

dateRange

A vector of two dates defining the desired study period. Only the start_date column of the OMOP table is checked to ensure it falls within this range. If dateRange is NULL, no restriction is applied.

Value

A summarised_result object with results overall and, if specified, by strata.

Examples

# \donttest{
library(OmopSketch)
library(CDMConnector)
library(duckdb)
#> Loading required package: DBI

requireEunomia()
#>  `EUNOMIA_DATA_FOLDER` set to: /tmp/Rtmptb2V1n.
#> 
#> Download completed!
con <- dbConnect(duckdb(), eunomiaDir())
#> Creating CDM database /tmp/Rtmptb2V1n/GiBleed_5.3.zip
cdm <- cdmFromCon(con = con, cdmSchema = "main", writeSchema = "main")
#> ! cdm name not specified and could not be inferred from the cdm source table

summariseConceptIdCounts(cdm, "condition_occurrence")
#> # A tibble: 80 × 13
#>    result_id cdm_name            group_name group_level strata_name strata_level
#>        <int> <chr>               <chr>      <chr>       <chr>       <chr>       
#>  1         1 An OMOP CDM databa… omop_table condition_… overall     overall     
#>  2         1 An OMOP CDM databa… omop_table condition_… overall     overall     
#>  3         1 An OMOP CDM databa… omop_table condition_… overall     overall     
#>  4         1 An OMOP CDM databa… omop_table condition_… overall     overall     
#>  5         1 An OMOP CDM databa… omop_table condition_… overall     overall     
#>  6         1 An OMOP CDM databa… omop_table condition_… overall     overall     
#>  7         1 An OMOP CDM databa… omop_table condition_… overall     overall     
#>  8         1 An OMOP CDM databa… omop_table condition_… overall     overall     
#>  9         1 An OMOP CDM databa… omop_table condition_… overall     overall     
#> 10         1 An OMOP CDM databa… omop_table condition_… overall     overall     
#> # ℹ 70 more rows
#> # ℹ 7 more variables: variable_name <chr>, variable_level <chr>,
#> #   estimate_name <chr>, estimate_type <chr>, estimate_value <chr>,
#> #   additional_name <chr>, additional_level <chr>
# }