Styling advice on layout for tables and graphs, which package is the best?

It's not self-contained in the sense that anyone trying to reproduce what you're doing doesn't have your data (so, the dput(...) bit only works if you have the data to begin with).

However, the question you're asking is about formatting a table in the output document (in whatever form), so you don't even really need a reprex.

The table output options are varied, and there's no single package/option that fits all needs. The screenshot you have there is from viewing your data inside of RStudio, and will take some work to reproduce, if that's the exact aesthetic you're looking for.

There have been a couple threads about table formatting:

And there are some resources listed in those threads as well as here. It's definitely an area people are interested in working on, because it's not as easy as it could be. But, it's worth your time to go through the basics, and try different options, especially if you have a very specific end-aesthetic in mind.

@cderv's answer above shows you the code for using knitr kable. Currently you're loading the library, but not actually knitting your data into a table.

2 Likes