cells_stubhead | R Documentation |
cells_stubhead()
is used to target the table stubhead location
when applying a footnote with tab_footnote()
or adding custom style with
tab_style()
. The function is expressly used in each of those functions'
locations
argument. The 'stubhead' location is always present alongside the
'stub' location.
cells_stubhead()
A list object with the classes cells_stubhead
and location_cells
.
Using a summarized version of the pizzaplace
dataset, let's create a
gt table. Add a stubhead label with tab_stubhead()
and then style it
with tab_style()
in conjunction with the use of cells_stubhead()
in the
locations
argument.
pizzaplace |> dplyr::mutate(month = as.numeric(substr(date, 6, 7))) |> dplyr::group_by(month, type) |> dplyr::summarize(sold = dplyr::n(), .groups = "drop") |> dplyr::filter(month %in% 1:2) |> gt(rowname_col = "type") |> tab_stubhead(label = "type") |> tab_style( style = cell_fill(color = "lightblue"), locations = cells_stubhead() )
8-13
v0.2.0.5
(March 31, 2020)
Other location helper functions:
cells_body()
,
cells_column_labels()
,
cells_column_spanners()
,
cells_footnotes()
,
cells_grand_summary()
,
cells_row_groups()
,
cells_source_notes()
,
cells_stub()
,
cells_stub_grand_summary()
,
cells_stub_summary()
,
cells_summary()
,
cells_title()
,
location-helper
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.