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!

Hi,

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.

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

Hope this helps?

JW

1 Like

Thanks, that's really helpful!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.