gt/GreatTables
Both the gt
and great_tables
packages allow us to customize tables in R and Python.
Links to the Packages:
Review of Table Anatomy
Part | Design Principles | functions |
---|---|---|
Structure | Header | tab_header() |
Structure | Column Labels | cols_label() |
Structure | Column Ordering | polars /dplyr |
Structure | Column Spanning | tab_spanner() |
Structure | Row Ordering | tab_stub(row_col) |
Structure | Row Grouping | tab_stub(grouping_col) |
Structure | Summary Rows | summary_rows() |
Formatting | Units | fmt_ functions |
Style | Font/Font Weight | tab_style() + selectors |
Style | Spacing | tab_style() + selectors |
Style | Color | tab_style() + selectors |
Style | Borders | tab_style() + selectors |
Style | Zebra Stripes | opt_row_striping() |
Resources
This part of the tutorial was heavily adapted from Rich Iannone and Michael Chow’s GT tutorial given at PositConf 2024