useful when you want to place a ggplot and gt table side-by-side. To use this function you must install the magick R package AND system program (see https://docs.ropensci.org/magick/articles/intro.html#installing-magick-1)
as_ggplot(x, ...)
gt or gtsummary table
arguments passed to gt::gtsave()
a ggplot object
Other gtsummary-related functions:
add_inline_forest_plot()
,
add_sparkline()
,
bold_italicize_group_labels()
,
logistic_reg_adj_diff()
,
style_tbl_compact()
,
tbl_likert()
,
theme_gtsummary_msk()
library(gtsummary)
library(ggplot2)
library(patchwork)
# # convert gtsummary table to ggplot
# tbl <-
# trial %>%
# select(age, marker, trt) %>%
# tbl_summary(by = trt, missing = "no") %>%
# as_ggplot()
#
# # create basic ggplot
# gg <-
# trial %>%
# ggplot(aes(x = age, y = marker, color = trt)) +
# geom_point()
#
# # stack tables using patchwork
# gg / tbl