## ----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)

  # Inspect the main exported components created by a completed run.
  names(study)
}

## ----include = TRUE, eval=FALSE, echo=TRUE------------------------------------
# 
# ################################################################################
# #
# # Execute
# #
# ################################################################################
# 
# data = CohortContrast::CohortContrast(
#   cdm,
#   targetTable = targetTable,
#   controlTable = controlTable,
#   pathToResults = file.path(getwd(), "studies"),
#   domainsIncluded = c(
#     "Drug",
#     "Condition",
#     "Measurement",
#     "Observation",
#     "Procedure",
#     "Visit",
#     "Visit detail",
#     "Death"
#   ),
#   prevalenceCutOff = 2.5,
#   topK = FALSE, # Number of features to export
#   presenceFilter = 0.2, # 0-1, percentage of people who must have the chosen feature present
#   complementaryMappingTable = NULL, # Optional manual concept mapping table
#   getSourceData = FALSE, # If true will generate summaries with source data as well
#   runChi2YTests = TRUE,
#   runLogitTests = FALSE,
#   createOutputFiles = TRUE,
#   complName = "LungCancer_1Y")
# 

## ----include = TRUE, eval=FALSE, echo=TRUE------------------------------------
# reloaded <- CohortContrast::loadCohortContrastStudy(
#   studyName = "LungCancer_1Y",
#   pathToResults = file.path(getwd(), "studies")
# )

