Skip to contents

Summarise the characteristics of the base population of a cdm_reference object.

Usage

summarisePopulationCharacteristics(
  cdm,
  studyPeriod = c(NA, NA),
  sex = FALSE,
  ageGroup = NULL
)

Arguments

cdm

A cdm_reference object.

studyPeriod

Dates to trim the observation period. If NA, min(observation_period_start_date) and/or max(observation_period_end_date) are used.

sex

Whether to stratify the results by sex.

ageGroup

List of age groups to stratify by at index date.

Value

A summarised_result object.

Examples

# \donttest{
cdm <- mockOmopSketch()

summarisedPopulation <- summarisePopulationCharacteristics(
  cdm = cdm,
  studyPeriod = c("2010-01-01", NA),
  sex = TRUE,
  ageGroup = NULL
)
#> ! cohort columns will be reordered to match the expected order:
#>   cohort_definition_id, subject_id, cohort_start_date, and cohort_end_date.
#>  Building new trimmed cohort
#> Creating initial cohort
#>  Cohort trimmed
#>  adding demographics columns
#>  summarising data
#>  summariseCharacteristics finished!
#> ! The following column type were changed:
#>  variable_name: from integer to character

summarisedPopulation |> print()
#> # A tibble: 122 × 13
#>    result_id cdm_name       group_name  group_level  strata_name strata_level
#>        <int> <chr>          <chr>       <chr>        <chr>       <chr>       
#>  1         1 mockOmopSketch cohort_name demographics overall     overall     
#>  2         1 mockOmopSketch cohort_name demographics sex         Female      
#>  3         1 mockOmopSketch cohort_name demographics sex         Male        
#>  4         1 mockOmopSketch cohort_name demographics overall     overall     
#>  5         1 mockOmopSketch cohort_name demographics sex         Female      
#>  6         1 mockOmopSketch cohort_name demographics sex         Male        
#>  7         1 mockOmopSketch cohort_name demographics overall     overall     
#>  8         1 mockOmopSketch cohort_name demographics overall     overall     
#>  9         1 mockOmopSketch cohort_name demographics overall     overall     
#> 10         1 mockOmopSketch cohort_name demographics overall     overall     
#> # ℹ 112 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>

PatientProfiles::mockDisconnect(cdm = cdm)
# }