Skip to contents

Derived Variables

These functions derive variables from existing data.

charlson_comorbidity_index()
Compute Charlson comorbidity index (CCI) score
comorbidity_index()
Compute Comorbidity Index
covid_flag()
COVID Flag
daily_census()
Compute daily census
day_time_of_admission()
Compute day & time of hospital admissions
disability()
Identify encounters with disability
elixhauser_comorbidity_index()
Compute Elixhauser comorbidity score
episodes_of_care()
Identify episodes of care
er_los()
Compute Length of Stay in Emergency Room
frailty_score()
Compute CIHI Hospital Frailty Risk Score
homelessness()
Homelessness flag
hospital_fiscal_year()
Get hospital fiscal year
hospitalizations_last_n_days()
Compute number of previous hospitalizations for an encounter in a given window.
icu_entry()
Compute entry to Intensive Care Unit
icu_los()
Compute Length of Stay in Intensive Care Unit
in_hospital_mortality()
Compute in-hospital mortality using CIHI DAD
laps_assign_test()
Assign score to LAPS component
length_of_stay()
Compute hospital Length of Stay (LoS)
loop_mlaps()
Loop mLAPS
mlaps()
mLAPS
n_imaging()
Compute the number of radiology tests per encounter
n_missing() mi2()
Number of missingness
n_rbc_transfusions()
Count the number Red Blood Cell (RBC) Transfusions per encounter
n_routine_bloodwork()
Compute the number of routine bloodwork tests per encounter
readmission()
Compute readmission and episodes of care.
season()
Get Season
stat_holidays_ON()
Flag statutory holidays in Ontario

Data Transformation

These functions aid in querying the data, either by applying filters or mapping values.

diagnoses_at_admission()
Determine Diagnoses at Admission
icd_to_ccsr()
Identify CCSR categories for ICD-10-CA diagnosis codes
max_result_value()
Calculates maxima when input vector is not empty, else returns NA.
min_result_value()
Calculates minima when input vector is not empty, else returns NA.

Cell Suppression

This includes all helper functions associated with producing a Table 1.

max_pairwise_smd()
Maximum Pairwise Standardized Mean Difference
render_cell_suppression.categorical()
Render Cell Suppression (Categorical)
render_cell_suppression.continuous()
Render Cell Suppression (Continuous)
render_cell_suppression.default()
Render Cell Suppression (Default)
render_cell_suppression.discrete()
Render Cell Suppression (Discrete)
render_cell_suppression.missing()
Render Cell Suppression (Missing)
render_cell_suppression.strat()
Render Cell Suppression (Strata)
render_default.discrete()
Render Default (Discrete)
render_mean.continuous()
Render Mean (Continuous)
render_median.continuous()
Render Median (Continuous)
render_strict_cell_suppression.categorical()
Render Strict Cell Suppression (Categorical)

Dummy Data

Helper functions designed to produce sample data.

dummy_admdad()
Generated simulated administrative data
dummy_diag()
Generate Simulated Diagnosis Data Table
dummy_ipadmdad()
Simulate ipadmdad data
dummy_lab()
Generated simulated lab data
sample_icd()
Simulate ICD-10 Diagnosis Codes

Plotting Functions

Functions for common plotting needs.

gemini_colors()
GEMINI colors
plot_color_palettes()
Plot GEMINI color palettes
plot_over_time()
Plot variable over time
plot_summary()
Plot descriptive summary statistics of multiple variables
plot_theme()
Plot theme for ggplots
scale_color_gemini()
Wrapper function for ggplot2::scale_color_manual() that applies GEMINI color palettes to ggplot objects.
scale_fill_gemini()
Wrapper function for ggplot2::scale_fill_manual() that applies GEMINI color palettes to ggplot objects.

Mapping files

Files containing variable mappings.

mapping_cihi_frailty
Mapping data for frailty_score function
mapping_disability
Mapping data for disability function

Utility Functions

check_input()
Check user inputs
coerce_to_datatable()
Coerce to data.table
coverage_message()
Coverage Message
convert_dt()
Convert date-time variables into POSIXct/POSIXt format.
find_db_tablename()
Find DB table name using regex search.
fix_var_str()
Fix variable strings
lunique()
Returns number of unique values
mapping_message()
Mapping Message
gemini_colors()
GEMINI colors
`%ni%`
Not In
scale_color_gemini()
Wrapper function for ggplot2::scale_color_manual() that applies GEMINI color palettes to ggplot objects.
scale_fill_gemini()
Wrapper function for ggplot2::scale_fill_manual() that applies GEMINI color palettes to ggplot objects.
return_hospital_field()
Return Hospital Field