I will be pretty straight forward with my question, as can be seen Created on 2022-03-10 by the reprex package (v2.0.1)
You can read more about gtsummary and Rmarkdown here https://www.danieldsjoberg.com/gtsummary/articles/rmarkdown.html
CodePudding user response:
I am not sure if it works for you, but one possible way is to add a latex code chunk in your r markdown. For example,
library(gtsummary)
library(gt)
mod1 <- lm(mpg~cyl, data = mtcars)
tbl_regression(mod1) %>% as_gt() %>% as_latex()
This will give you the latex code of the table. Now insert a latex code chunk in your r markdown document. The header of that code chunk will have
```{=latex}
your latex code
```
Don't forget to add = sign in the latex code chunk. You can edit your latex code whatever way you want. This will be valid even if your output format is word_document.