I am working on a Quarto project and use R for statistical analyses, modelsummary to format the output tables and kableExtra to style those accordingly.
However, when using modelsummary with kableExtra, I am encountering a weird error where the output in the PDF is the raw LaTeX code for the table, but not the (rendered) table itself:
I encounter this problem specifically when calling kbl():
library(kableExtra)
library(modelsummary)
model <- lm(mpg ~ hp, data = mtcars)
modelsummary(model) |>
kbl() |>
kable_styling(full_width = TRUE)
When I skip kbl(), there is no problem - but I need some functionality of kbl() (e.g., longtable and booktabs). I already tried modifying the code blocks output, i.e. #| output: asis as well as all different combinations of modelsummary's format argument and kbl()'s output argument. Nothing seems to work - any ideas?
These two packages work well together, use this code to make it work:
for pdf