Model output table

Hi. I'm new to markdown and trying to find a quick and easy way to display my model output (effect sizes, p values, etc..). If it matters, the model is a Structural Equation Model using the piecewiseSEM package. When I run my code chunk I see the "data.frames" (in the screenshot below). Is there a way I can simply include these in the output when I knit the file? Currently I have selected for the output only to be shown and I end up with the R console output which is not easy to read and doesn't look nice. I'd really appreciate any advice!


Are you looking for typesetting for tables? There are many packages available you can try, e.g. kable, xtable, or gt... Here's an example with kableExtra (to use kable with pipe). Look into the documentation for a tonnage of typesetting options.

head(mtcars) %>%                                                                   
        dplyr::select(1:8) %>%                                                     
        kableExtra::kbl() %>%                                                      
        kableExtra::kable_styling(position = "center", full_width = FALSE) %>%     

Hope this helps?


1 Like

Thanks, that's really helpful!