Skip to contents

Visualise the results of summarisePerson() into a table

Visualise the output of summarisePerson()

Usage

tablePerson(
  result,
  header = "cdm_name",
  hide = omopgenerics::settingsColumns(result),
  groupColumn = character(),
  type = NULL,
  style = NULL
)

tablePerson(
  result,
  header = "cdm_name",
  hide = omopgenerics::settingsColumns(result),
  groupColumn = character(),
  type = NULL,
  style = NULL
)

Arguments

result

A summarised_result object (output of summarisePerson()).

header

A vector specifying the elements to include in the header. The order of elements matters, with the first being the topmost header.

hide

Columns to drop from the output table.

groupColumn

Columns to use as group labels, to see options use visOmopResults::tableColumns(result).

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.

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 (seevisOmopResults::setGlobalTableOptions()) or a _brand.yml file (if found); otherwise, the default style is applied.

Value

A formatted table visualisation.

A formatted table visualisation.

Examples

# \donttest{
library(OmopSketch)
library(omock)

cdm <- mockCdmFromDataset(datasetName = "GiBleed", source = "duckdb")
#>  Loading bundled GiBleed tables from package data.
#>  Adding drug_strength table.
#>  Creating local <cdm_reference> object.
#>  Inserting <cdm_reference> into duckdb.

result <- summarisePerson(cdm = cdm)

tablePerson(result = result)
#> ! The following column type were changed:
#>  variable_name: from integer to character
Summary of person table
Variable name Variable level Estimate name
CDM name
GiBleed
Number subjects N 2,694
Number subjects not in observation N (%) 0 (0.00%)
Sex Female N (%) 1,373 (50.97%)
Male N (%) 1,321 (49.03%)
None N (%) 0 (0.00%)
Sex source F N (%) 1,373 (50.97%)
M N (%) 1,321 (49.03%)
Race Missing N (%) 2,243 (83.26%)
No matching concept N (%) 451 (16.74%)
Race source asian N (%) 212 (7.87%)
black N (%) 338 (12.55%)
hispanic N (%) 435 (16.15%)
native N (%) 14 (0.52%)
other N (%) 2 (0.07%)
white N (%) 1,693 (62.84%)
Ethnicity Missing N (%) 435 (16.15%)
No matching concept N (%) 2,259 (83.85%)
Ethnicity source african N (%) 119 (4.42%)
american N (%) 79 (2.93%)
american_indian N (%) 14 (0.52%)
arab N (%) 2 (0.07%)
asian_indian N (%) 81 (3.01%)
central_american N (%) 75 (2.78%)
chinese N (%) 131 (4.86%)
dominican N (%) 105 (3.90%)
english N (%) 218 (8.09%)
french N (%) 129 (4.79%)
french_canadian N (%) 74 (2.75%)
german N (%) 130 (4.83%)
greek N (%) 19 (0.71%)
irish N (%) 438 (16.26%)
italian N (%) 295 (10.95%)
mexican N (%) 42 (1.56%)
polish N (%) 107 (3.97%)
portuguese N (%) 93 (3.45%)
puerto_rican N (%) 258 (9.58%)
russian N (%) 34 (1.26%)
scottish N (%) 48 (1.78%)
south_american N (%) 60 (2.23%)
swedish N (%) 29 (1.08%)
west_indian N (%) 114 (4.23%)
Year of birth Missing (%) 0 (0.00%)
Median [Q25 - Q75] 1,961 [1,950 - 1,970]
90% Range [Q05 to Q95] 1,922 to 1,979
Range [min to max] 1,908 to 1,986
Month of birth Missing (%) 0 (0.00%)
Median [Q25 - Q75] 7 [4 - 10]
90% Range [Q05 to Q95] 1 to 12
Range [min to max] 1 to 12
Day of birth Missing (%) 0 (0.00%)
Median [Q25 - Q75] 16 [8 - 23]
90% Range [Q05 to Q95] 2 to 29
Range [min to max] 1 to 31
Location Missing (%) 2,694 (100.00%)
Zero count (%) 0 (0.00%)
Distinct values 1
Provider Missing (%) 2,694 (100.00%)
Zero count (%) 0 (0.00%)
Distinct values 1
Care site Missing (%) 2,694 (100.00%)
Zero count (%) 0 (0.00%)
Distinct values 1
# } # \donttest{ library(OmopSketch) library(omock) cdm <- mockCdmFromDataset(datasetName = "GiBleed", source = "duckdb") #> Loading bundled GiBleed tables from package data. #> Adding drug_strength table. #> Creating local <cdm_reference> object. #> Inserting <cdm_reference> into duckdb. result <- summarisePerson(cdm = cdm) tablePerson(result = result) #> ! The following column type were changed: #> variable_name: from integer to character
Summary of person table
Variable name Variable level Estimate name
CDM name
GiBleed
Number subjects N 2,694
Number subjects not in observation N (%) 0 (0.00%)
Sex Female N (%) 1,373 (50.97%)
Male N (%) 1,321 (49.03%)
None N (%) 0 (0.00%)
Sex source F N (%) 1,373 (50.97%)
M N (%) 1,321 (49.03%)
Race Missing N (%) 2,243 (83.26%)
No matching concept N (%) 451 (16.74%)
Race source asian N (%) 212 (7.87%)
black N (%) 338 (12.55%)
hispanic N (%) 435 (16.15%)
native N (%) 14 (0.52%)
other N (%) 2 (0.07%)
white N (%) 1,693 (62.84%)
Ethnicity Missing N (%) 435 (16.15%)
No matching concept N (%) 2,259 (83.85%)
Ethnicity source african N (%) 119 (4.42%)
american N (%) 79 (2.93%)
american_indian N (%) 14 (0.52%)
arab N (%) 2 (0.07%)
asian_indian N (%) 81 (3.01%)
central_american N (%) 75 (2.78%)
chinese N (%) 131 (4.86%)
dominican N (%) 105 (3.90%)
english N (%) 218 (8.09%)
french N (%) 129 (4.79%)
french_canadian N (%) 74 (2.75%)
german N (%) 130 (4.83%)
greek N (%) 19 (0.71%)
irish N (%) 438 (16.26%)
italian N (%) 295 (10.95%)
mexican N (%) 42 (1.56%)
polish N (%) 107 (3.97%)
portuguese N (%) 93 (3.45%)
puerto_rican N (%) 258 (9.58%)
russian N (%) 34 (1.26%)
scottish N (%) 48 (1.78%)
south_american N (%) 60 (2.23%)
swedish N (%) 29 (1.08%)
west_indian N (%) 114 (4.23%)
Year of birth Missing (%) 0 (0.00%)
Median [Q25 - Q75] 1,961 [1,950 - 1,970]
90% Range [Q05 to Q95] 1,922 to 1,979
Range [min to max] 1,908 to 1,986
Month of birth Missing (%) 0 (0.00%)
Median [Q25 - Q75] 7 [4 - 10]
90% Range [Q05 to Q95] 1 to 12
Range [min to max] 1 to 12
Day of birth Missing (%) 0 (0.00%)
Median [Q25 - Q75] 16 [8 - 23]
90% Range [Q05 to Q95] 2 to 29
Range [min to max] 1 to 31
Location Missing (%) 2,694 (100.00%)
Zero count (%) 0 (0.00%)
Distinct values 1
Provider Missing (%) 2,694 (100.00%)
Zero count (%) 0 (0.00%)
Distinct values 1
Care site Missing (%) 2,694 (100.00%)
Zero count (%) 0 (0.00%)
Distinct values 1
cdmDisconnect(cdm = cdm) # }