Add a table header
We can add a table header to the gt table with a title and even a subtitle. A table header is an optional table part that is positioned above the column labels. We have the flexibility to use Markdown formatting for the header's title and subtitle. Furthermore, if the table is intended for HTML output, we can use HTML in either of the title or subtitle.
tab_header(data, title, subtitle = NULL)
An object of class gt_tbl
.
2-1
Other Create or Modify Parts:
tab_footnote()
,
tab_options()
,
tab_row_group()
,
tab_source_note()
,
tab_spanner_delim()
,
tab_spanner()
,
tab_stubhead()
,
tab_style()
# Use `gtcars` to create a gt table; # add a header part to contain a title # and subtitle tab_1 <- gtcars %>% dplyr::select(mfr, model, msrp) %>% dplyr::slice(1:5) %>% gt() %>% tab_header( title = md("Data listing from **gtcars**"), subtitle = md("`gtcars` is an R dataset") )
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.