## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

## -----------------------------------------------------------------------------
if (requireNamespace("nanoparquet", quietly = TRUE)) {
  studyDir <- system.file("example", "st", package = "CohortContrast")
  study <- CohortContrast::loadCohortContrastStudy("lc500", pathToResults = studyDir)

  # Summarize overall cohort size and a couple of basic demographic indicators.
  data.frame(
    n_patients = nrow(study$data_person),
    median_birth_year = stats::median(study$data_person$YEAR_OF_BIRTH),
    male_proportion = mean(study$data_person$GENDER_CONCEPT_ID == 8507)
  )
}

