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)
CDM name
PP_MOCK
Variable name Variable level Estimate name
Cohort name
cohort_1 cohort_2 cohort_3
Number records N 4 3 3
Number subjects N 4 3 3
Cohort start date Median [Q25 - Q75] 1948-04-20 [1940-08-02 - 1954-03-20] 1976-02-11 [1952-02-28 - 1984-02-09] 1951-06-21 [1947-09-25 - 1970-04-17]
Range 1928-12-26 to 1960-05-29 1928-03-16 to 1992-02-07 1943-12-31 to 1989-02-10
Cohort end date Median [Q25 - Q75] 1955-09-23 [1947-01-10 - 1960-10-29] 1994-11-11 [1963-06-04 - 1998-01-14] 1965-10-30 [1956-02-15 - 1977-11-04]
Range 1932-10-22 to 1964-04-03 1931-12-26 to 2001-03-20 1946-06-02 to 1989-11-10
Age Median [Q25 - Q75] 10 [8 - 16] 10 [8 - 14] 17 [14 - 34]
Mean (SD) 12.50 (7.59) 11.67 (6.66) 25.67 (21.36)
Range 6 to 23 6 to 19 10 to 50
Sex Female N (%) 4 (100.00%) 1 (33.33%) 2 (66.67%)
Prior observation Median [Q25 - Q75] 3,992 [2,878 - 5,863] 3,693 [2,980 - 5,334] 6,380 [5,198 - 12,342]
Mean (SD) 4,747.75 (2,894.47) 4,311.67 (2,415.18) 9,566.33 (7,657.95)
Range 2,246 to 8,760 2,266 to 6,976 4,016 to 18,303
Future observation Median [Q25 - Q75] 2,756 [2,706 - 3,863] 4,964 [3,092 - 7,342] 6,192 [3,368 - 6,264]
Mean (SD) 3,813.75 (2,189.56) 5,301.00 (4,260.51) 4,357.67 (3,302.65)
Range 2,647 to 7,097 1,219 to 9,720 545 to 6,336
Days in cohort Median [Q25 - Q75] 2,038 [1,404 - 2,692] 1,381 [1,195 - 5,276] 885 [580 - 3,066]
Mean (SD) 2,056.75 (757.37) 3,853.33 (4,608.12) 2,135.00 (2,711.47)
Range 1,397 to 2,753 1,009 to 9,170 274 to 5,246
Days to next record Median [Q25 - Q75]
Mean (SD)
Range
Sex Male N (%) 2 (66.67%) 1 (33.33%)
# }