Learn R Programming

icd (version 4.0.6)

plot_comorbid: Basic ordered bar plot showing counts of each comorbidity

Description

Basic ordered bar plot showing counts of each comorbidity

Usage

plot_comorbid(x, comorbid_fun = icd::comorbid_ahrq, ...)

plot_comorbid_results(x, sort = TRUE, fix_margin = FALSE, las = 2, cex.names = 0.75, ...)

Arguments

x

input patient data

comorbid_fun

Character name of function or function itself, default being comorbid_ahrq

...

Passed to barplot

sort

Logical, default TRUE which sorts the frequencies from high to low.

fix_margin

Logical, default TRUE, which causes a par margin to be set so the x axis labels are less likely to be truncated.

las

Integer, default is 2 which rotates the x axis labels appropriately

cex.names

Numeric, default is 0.75 which scales the text size for labels appropriately

Functions

  • plot_comorbid_results: Plot the results of a call to one of the comorbidity settings.

Examples

Run this code
# NOT RUN {
library(icd)
plot_comorbid(vermont_dx)
plot_comorbid(uranium_pathology)
# Or calculate the comorbidities, then plot the results
cmb <- comorbid_ahrq(vermont_dx)
# plot with full, not abbreviated names
plot_comorbid_results(cmb, names.arg = names_ahrq)
# or return with full names, and plot those:
comorbid_ahrq(vermont_dx, abbrev_names = FALSE) %>%
  plot_comorbid_results()
# }

Run the code above in your browser using DataLab