as_ggplot | R Documentation |
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, ...)
x |
gt or gtsummary table |
... |
arguments passed to |
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.