Converts the table body (tbl$table_body) of a 'gtsummary' object into a data frame suitable for plotting with gg_forest_plot(). It selects and renames the necessary columns for the plot.

extract_plot_data(tbl)

Arguments

tbl

(gtsummary)
A 'gtsummary' object (e.g., from gtsummary::tbl_regression() or gtsummary::tbl_uvregression()).

Value

A data frame (tibble) with the columns: group (from term), estimate, ci_lower (from conf.low), ci_upper (from conf.high), and n (from N_obs).