Skip to contents

Format a summarised_treatment result into a visual table.

Usage

tableTreatment(
  result,
  header = c("cdm_name", "cohort_name"),
  groupColumn = "variable_name",
  type = "gt",
  hide = c("window_name", "mutually_exclusive", "censor_date", "cohort_table_name",
    "index_date", "treatment_cohort_name")
)

Arguments

result

A summarised_result object.

header

Columns to use as header. See options with availableTableColumns(result).

groupColumn

Columns to group by. See options with availableTableColumns(result).

type

Type of table. Check supported types with visOmopResults::tableType().

hide

Columns to hide from the visualisation. See options with availableTableColumns(result).

Value

A table with a formatted version of summariseTreatment() results.

Examples

# \donttest{
cdm <- mockDrugUtilisation()

result <- cdm$cohort1 |>
  summariseTreatment(
    treatmentCohortName = "cohort2",
    window = list(c(0, 30), c(31, 365))
  )
#>  Intersect with medications table (cohort2)
#>  Summarising medications.

tableTreatment(result)
cdm_name
DUS MOCK
Treatment estimate_name
cohort_name
cohort_1 cohort_2 cohort_3
Medication from index date to 30 days after
cohort_1 N (%) 1 (50.0 %) 0 (0.0 %) 1 (25.0 %)
cohort_2 N (%) 0 (0.0 %) 0 (0.0 %) 0 (0.0 %)
cohort_3 N (%) 0 (0.0 %) 1 (25.0 %) 0 (0.0 %)
untreated N (%) 1 (50.0 %) 3 (75.0 %) 3 (75.0 %)
not in observation N (%) 0 (0.0 %) 0 (0.0 %) 0 (0.0 %)
Medication from 31 days after to 365 days after the index date
cohort_1 N (%) 2 (100.0 %) 0 (0.0 %) 1 (25.0 %)
cohort_2 N (%) 0 (0.0 %) 0 (0.0 %) 1 (25.0 %)
cohort_3 N (%) 0 (0.0 %) 2 (50.0 %) 1 (25.0 %)
untreated N (%) 0 (0.0 %) 2 (50.0 %) 1 (25.0 %)
not in observation N (%) 0 (0.0 %) 0 (0.0 %) 0 (0.0 %)
# }