Making an odds ratio plot in R
Given their ease of calculation and simplicity, odds ratios are used near universally in medical reporting. While many researchers still prefer the tabular format to report ORs, the odds ratio plots, or forest plots, have recently come into vogue. There are many ways to generate OR plot in R, but the one that I find to be most intuitive and least onerous is the ‘finalfit’ package.
Here is a quick demonstration:
install.packages("finalfit")
library(finalfit)
Load the colon_s dataset
data(colon_s)
Define the dependent and independent variables:
iv = c("age.factor", "sex.factor", "obstruct.factor")
dv = "mort_5yr"
now time to make the plot:
colon_s %>%
or_plot(dv, iv)
Here is the quick and sweet output: