I have been looking at ways to present tables in R. I missed Neil Collins’ summary back in April (link) when he included reference to kable.
In the interim, I have been trying to use the gt package (link) but have struggled to format the tables produced.
kable has enabled me to produce tables and I note that it is “a very simple table generator. It is simple by design. It is not intended to replace any other R packages for making tables” (link). The basic table that heads this post is an example of a kable table.
The code I have used and the csv file from the Women’s World Cup are shared in a GitHub repository (link).
I did find Hao Zhu’s (2019) guide to kable very helpful (link) and followed the his guidelines closely … all of which worked. I thought about column names too and used JM’s RProgramming Guide to renaming columns in R (link). In my example, I used JM’s guide to reduced 14 variables in my original data frame (df) to 4 in the shortened version (df1).
I am looking forward to exploring more of the kable functionality. I do find its intuitive characteristics very encouraging.