I am trying to output {gtsummary} tables (specifically tbl_regression()
output) as images. I am using kableExtra::as_image()
but the result is not very pretty. A reprex is below but I don't have the reputation to post an image.
Is there a way to programmatically get an image of the tbl_regression()
output? On the {gtsummary} github site, there are very nice table images in the README but I am not sure if they were created manually or with code as I don't see any functions that extracted them.
library(gtsummary)
library(kableExtra)
m_linear <-
lm(mpg ~ cyl, data = mtcars)
gtsummary::tbl_regression(m_linear) %>%
gtsummary::as_kable() %>%
kableExtra::as_image(file = "t.png")
Created on 2020-03-18 by the reprex package (v0.3.0)