get_contingency_table: Contingency table between ward category and main...

View source: R/boarding.R

get_contingency_tableR Documentation

Contingency table between ward category and main specialty/disease categories.

Description

get_ward_specialty_contingency_table returns a table showing the relationship between ward types and main specialties or disease groups. Used in patient boarding analysis to infer what type of patients a given ward is designed to accommodate. The function is currently using a 1-to-1 mapping between ICD-10 codes and CCSR categories. There is a possibility to include a 1-to-many mapping in the analysis in the future if needed.

Usage

get_contingency_table(ipData, vars, scaleBy = "none", returnPlot = FALSE)

Arguments

ipData

Hospital inpatient episode data with at least the following fields:

  • ward_category - category of the ward;

  • main_specialty - main specialty of the clinician responsible for the episode;

  • ccsr_category_description - disease group that ICD-10 code of the patient belongs to.

vars

Variables of interest - either "ws" (ward type - main specialty) or "wd" (ward type - CCSR disease category).

scaleBy

Whether and how entries of contingency table should be scaled.

  • "none" - no scaling, presents absolute episode counts;

  • "rowsum" - normalizes by the total number of episodes in a given ward. Useful when investigating the distribution of specialties/diseases among wards.

  • "colsum" - normalizes by the total number of episodes in a given specialty/disease group. Useful when investigating the distribution of wards among specialties/diseases.

  • "total" - normalizes by the total number of episodes.

returnPlot

A boolean value indicating whether a plot (heatmap) should be return. If FALSE, a table is returned.

Value

A contingency table (default) or a heatmap showing the relationship between ward type and main specialty or CCSR categories.

Examples

## Not run: 
get_contingency_table(
  ip_data = inpatient_data,
  vars = "ws",
  scaleBy = "none",
  returnPlot = FALSE
)

## End(Not run)


HorridTom/hospitalflow documentation built on June 14, 2022, noon