Skip to contents

[Experimental]

Usage

tableCharacteristics(
  result,
  type = NULL,
  header = c("cdm_name", "cohort_name"),
  groupColumn = character(),
  hide = c(additionalColumns(result), settingsColumns(result)),
  style = NULL,
  .options = list()
)

Arguments

result

A summarised_result object.

type

Character string specifying the desired output table format. See visOmopResults::tableType() for supported table types. If type = NULL, global options (set via visOmopResults::setGlobalTableOptions()) will be used if available; otherwise, a default 'gt' table is created.

header

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

groupColumn

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

hide

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

style

Defines the visual formatting of the table. This argument can be provided in one of the following ways:

  1. Pre-defined style: Use the name of a built-in style (e.g., "darwin"). See visOmopResults::tableStyle() for available options.

  2. YAML file path: Provide the path to an existing .yml file defining a new style.

  3. List of custome R code: Supply a block of custom R code or a named list describing styles for each table section. This code must be specific to the selected table type.

If style = NULL, the function will use global options (see visOmopResults::setGlobalTableOptions()) or an existing _brand.yml file (if found); otherwise, the default style is applied. For more details, see the Styles vignette in visOmopResults website.

.options

A named list with additional formatting options. visOmopResults::tableOptions() shows allowed arguments and their default values.

Value

A formatted table.

Examples

# \donttest{
library(CohortCharacteristics)

cdm <- mockCohortCharacteristics()

result <- summariseCharacteristics(cdm$cohort1)
#> ℹ adding demographics columns
#> ℹ summarising data
#> ℹ summarising cohort cohort_1
#> ℹ summarising cohort cohort_2
#> ℹ summarising cohort cohort_3
#> ✔ summariseCharacteristics finished!

tableCharacteristics(result)
Data source
PP_MOCK
Variable name Variable level Estimate name
Cohort name
cohort_1 cohort_2 cohort_3
Number records – N 6 2 2
Number subjects – N 6 2 2
Age – Median [Q25 - Q75] 18 [8 - 26] 6 [3 - 9] 20 [18 - 22]
Mean (SD) 19.00 (13.64) 6.00 (8.49) 20.00 (7.07)
Range 5 to 40 0 to 12 15 to 25
Sex Female N (%) 1 (16.67%) – 2 (100.00%)
Male N (%) 5 (83.33%) 2 (100.00%) –
Prior observation – Median [Q25 - Q75] 6,746 [3,066 - 9,639] 2,479 [1,397 - 3,561] 7,480 [6,636 - 8,325]
Mean (SD) 7,110.33 (4,982.33) 2,479.00 (3,060.36) 7,480.50 (2,389.31)
Range 2,026 to 14,701 315 to 4,643 5,791 to 9,170
Future observation – Median [Q25 - Q75] 7,426 [5,487 - 8,918] 6,355 [3,746 - 8,964] 2,249 [1,262 - 3,236]
Mean (SD) 7,181.67 (4,431.84) 6,355.00 (7,379.37) 2,249.00 (2,793.07)
Range 337 to 13,646 1,137 to 11,573 274 to 4,224
Days in cohort – Median [Q25 - Q75] 2,584 [766 - 3,462] 2,036 [1,079 - 2,992] 666 [438 - 894]
Mean (SD) 2,578.33 (2,290.36) 2,035.50 (2,706.10) 666.00 (646.30)
Range 126 to 6,262 122 to 3,949 209 to 1,123
Days to next record – Median [Q25 - Q75] – – –
Mean (SD) – – –
Range – – –
Cohort start date – Median [Q25 - Q75] 1973-09-02 [1933-12-09 - 1988-08-29] 1963-04-16 [1952-07-30 - 1973-12-31] 1940-12-24 [1938-06-02 - 1943-07-19]
Range 1913-07-19 to 1991-07-29 1941-11-12 to 1984-09-17 1935-11-09 to 1946-02-09
Cohort end date – Median [Q25 - Q75] 1975-12-22 [1946-11-18 - 1993-09-05] 1968-11-09 [1955-07-12 - 1982-03-11] 1942-10-21 [1940-11-12 - 1944-09-27]
Range 1923-06-24 to 1996-12-18 1942-03-13 to 1995-07-10 1938-12-05 to 1946-09-05
# }