Set format options for all subsequent tables unless state a different style in a specific function
Arguments
- style
Named list that specifies how to style the different parts of the gt or flextable table generated. Accepted style entries are: title, subtitle, header, header_name, header_level, column_name, group_label, and body. Alternatively, use "default" to get visOmopResults style, or NULL for gt/flextable style. Keep in mind that styling code is different for gt and flextable. Additionally, "datatable" and "reactable" have their own style functions. To see style options for each table type use
tableStyle()
.- type
The desired format of the output table. See
tableType()
for allowed options. If "tibble", no formatting will be applied.
Examples
setGlobalTableOptions(style = "darwin", type = "tinytable")
result <- mockSummarisedResult()
result |>
visOmopTable(
estimateName = c("N%" = "<count> (<percentage>)",
"N" = "<count>",
"Mean (SD)" = "<mean> (<sd>)"),
header = c("cohort_name"),
rename = c("Database name" = "cdm_name"),
groupColumn = strataColumns(result)
)
#> +-------------------+-------------------+--------------------+-------------------+----------------+----------------+
#> | | **Cohort name** |
#> +-------------------+-------------------+--------------------+-------------------+----------------+----------------+
#> | **Database name** | **Variable name** | **Variable level** | **Estimate name** | **cohort1** | **cohort2** |
#> +===================+===================+====================+===================+================+================+
#> | **overall; overall** |
#> +-------------------+-------------------+--------------------+-------------------+----------------+----------------+
#> | mock | number subjects | - | N | 2,655,087 | 617,863 |
#> +-------------------+-------------------+--------------------+-------------------+----------------+----------------+
#> | | age | - | Mean (SD) | 38.00 (7.94) | 38.24 (7.89) |
#> +-------------------+-------------------+--------------------+-------------------+----------------+----------------+
#> | | Medications | Amoxiciline | N% | 7,068 (34.67) | 33,239 (71.25) |
#> +-------------------+-------------------+--------------------+-------------------+----------------+----------------+
#> | | | Ibuprofen | N% | 23,963 (92.41) | 60,493 (10.32) |
#> +-------------------+-------------------+--------------------+-------------------+----------------+----------------+
#> | **<40; Male** |
#> +-------------------+-------------------+--------------------+-------------------+----------------+----------------+
#> | mock | number subjects | - | N | 3,721,239 | 2,059,746 |
#> +-------------------+-------------------+--------------------+-------------------+----------------+----------------+
#> | | age | - | Mean (SD) | 77.74 (1.08) | 86.97 (0.23) |
#> +-------------------+-------------------+--------------------+-------------------+----------------+----------------+
#> | | Medications | Amoxiciline | N% | 9,947 (33.38) | 65,087 (40.00) |
#> +-------------------+-------------------+--------------------+-------------------+----------------+----------------+
#> | | | Ibuprofen | N% | 5,893 (59.88) | 65,472 (44.63) |
#> +-------------------+-------------------+--------------------+-------------------+----------------+----------------+
#> | **>=40; Male** |
#> +-------------------+-------------------+--------------------+-------------------+----------------+----------------+
#> | mock | number subjects | - | N | 5,728,534 | 1,765,568 |
#> +-------------------+-------------------+--------------------+-------------------+----------------+----------------+
#> | | age | - | Mean (SD) | 93.47 (7.24) | 34.03 (4.77) |
#> +-------------------+-------------------+--------------------+-------------------+----------------+----------------+
#> | | Medications | Amoxiciline | N% | 31,627 (47.64) | 25,802 (32.54) |
#> +-------------------+-------------------+--------------------+-------------------+----------------+----------------+
#> | | | Ibuprofen | N% | 64,229 (97.62) | 35,320 (64.01) |
#> +-------------------+-------------------+--------------------+-------------------+----------------+----------------+
#> | **<40; Female** |
#> +-------------------+-------------------+--------------------+-------------------+----------------+----------------+
#> | mock | number subjects | - | N | 9,082,078 | 6,870,228 |
#> +-------------------+-------------------+--------------------+-------------------+----------------+----------------+
#> | | age | - | Mean (SD) | 21.21 (4.11) | 48.21 (7.32) |
#> +-------------------+-------------------+--------------------+-------------------+----------------+----------------+
#> | | Medications | Amoxiciline | N% | 51,863 (89.22) | 47,855 (75.71) |
#> +-------------------+-------------------+--------------------+-------------------+----------------+----------------+
#> | | | Ibuprofen | N% | 87,627 (73.18) | 27,026 (99.18) |
#> +-------------------+-------------------+--------------------+-------------------+----------------+----------------+
#> | **>=40; Female** |
#> +-------------------+-------------------+--------------------+-------------------+----------------+----------------+
#> | mock | number subjects | - | N | 2,016,819 | 3,841,037 |
#> +-------------------+-------------------+--------------------+-------------------+----------------+----------------+
#> | | age | - | Mean (SD) | 65.17 (8.21) | 59.96 (6.93) |
#> +-------------------+-------------------+--------------------+-------------------+----------------+----------------+
#> | | Medications | Amoxiciline | N% | 66,201 (86.43) | 76,631 (20.27) |
#> +-------------------+-------------------+--------------------+-------------------+----------------+----------------+
#> | | | Ibuprofen | N% | 77,891 (35.67) | 99,268 (49.56) |
#> +-------------------+-------------------+--------------------+-------------------+----------------+----------------+
#> | **overall; Male** |
#> +-------------------+-------------------+--------------------+-------------------+----------------+----------------+
#> | mock | number subjects | - | N | 8,983,897 | 7,698,414 |
#> +-------------------+-------------------+--------------------+-------------------+----------------+----------------+
#> | | age | - | Mean (SD) | 12.56 (6.47) | 49.35 (4.78) |
#> +-------------------+-------------------+--------------------+-------------------+----------------+----------------+
#> | | Medications | Amoxiciline | N% | 40,683 (39.00) | 8,425 (71.11) |
#> +-------------------+-------------------+--------------------+-------------------+----------------+----------------+
#> | | | Ibuprofen | N% | 79,731 (43.15) | 63,349 (48.43) |
#> +-------------------+-------------------+--------------------+-------------------+----------------+----------------+
#> | **overall; Female** |
#> +-------------------+-------------------+--------------------+-------------------+----------------+----------------+
#> | mock | number subjects | - | N | 9,446,753 | 4,976,992 |
#> +-------------------+-------------------+--------------------+-------------------+----------------+----------------+
#> | | age | - | Mean (SD) | 26.72 (7.83) | 18.62 (8.61) |
#> +-------------------+-------------------+--------------------+-------------------+----------------+----------------+
#> | | Medications | Amoxiciline | N% | 91,288 (77.73) | 87,532 (12.17) |
#> +-------------------+-------------------+--------------------+-------------------+----------------+----------------+
#> | | | Ibuprofen | N% | 45,527 (14.82) | 21,321 (17.34) |
#> +-------------------+-------------------+--------------------+-------------------+----------------+----------------+
#> | **<40; overall** |
#> +-------------------+-------------------+--------------------+-------------------+----------------+----------------+
#> | mock | number subjects | - | N | 6,607,978 | 7,176,185 |
#> +-------------------+-------------------+--------------------+-------------------+----------------+----------------+
#> | | age | - | Mean (SD) | 38.61 (5.53) | 82.74 (4.38) |
#> +-------------------+-------------------+--------------------+-------------------+----------------+----------------+
#> | | Medications | Amoxiciline | N% | 29,360 (96.06) | 33,907 (24.55) |
#> +-------------------+-------------------+--------------------+-------------------+----------------+----------------+
#> | | | Ibuprofen | N% | 41,008 (1.31) | 12,937 (75.48) |
#> +-------------------+-------------------+--------------------+-------------------+----------------+----------------+
#> | **>=40; overall** |
#> +-------------------+-------------------+--------------------+-------------------+----------------+----------------+
#> | mock | number subjects | - | N | 6,291,140 | 9,919,061 |
#> +-------------------+-------------------+--------------------+-------------------+----------------+----------------+
#> | | age | - | Mean (SD) | 1.34 (5.30) | 66.85 (2.45) |
#> +-------------------+-------------------+--------------------+-------------------+----------------+----------------+
#> | | Medications | Amoxiciline | N% | 45,907 (43.47) | 83,944 (14.33) |
#> +-------------------+-------------------+--------------------+-------------------+----------------+----------------+
#> | | | Ibuprofen | N% | 81,087 (71.56) | 47,812 (45.39) |
#> +-------------------+-------------------+--------------------+-------------------+----------------+----------------+