The Table Header and Table Footer are bookend components that provide context for the data presented in your table. The header introduces the table with a title and optional subtitle, while the footer anchors it with source notes or other supplementary information. Both are added using the tab_*() family of methods.
Adding Source Notes
# Display the `islands_tbl` data with a heading and two source notes
(
gt_tbl
.tab_source_note(
source_note = "Source: The World Almanac and Book of Facts, 1975, page 406."
)
.tab_source_note(
source_note = md("Reference: McNeil, D. R. (1977) *Interactive Data Analysis*. Wiley.")
)
)
| Large Landmasses of the World 🌐 |
| The top ten largest are presented |
| name |
size |
| Africa |
11506 |
| Antarctica |
5500 |
| Source: The World Almanac and Book of Facts, 1975, page 406. |
| Reference: McNeil, D. R. (1977) Interactive Data Analysis. Wiley. |
With just a few method calls, we have added essential context to the table. The title and subtitle tell the reader what data is being presented, and the source notes provide attribution. Together, these components frame the table body and help your audience understand the data at a glance.