rm_footnotes | R Documentation |
If you have one or more footnotes that ought to be removed, rm_footnotes()
allows for such a selective removal. The table footer is an optional table
part that is positioned below the table body, containing areas for both the
footnotes and source notes.
This function for removal is useful if you have received a gt table
(perhaps through an API that returns gt objects) but would prefer that
some or all of the footnotes be removed. This function is safe to use even if
there are no footnotes in the input gt_tbl
object so long as select helpers
(such as the default everything()
) are used instead of explicit integer
values.
rm_footnotes(data, footnotes = everything())
data |
The gt table data object
This is the gt table object that is commonly created through use of the
|
footnotes |
Footnotes to remove
A specification of which footnotes should be removed. The footnotes to be
removed can be given as a vector of integer values (they are stored as
integer positions, in order of creation, starting at |
An object of class gt_tbl
.
Use a subset of the sza
dataset to create a gt table. Color the sza
column using data_color()
, then, use tab_footnote()
twice to
add two footnotes (each one targeting a different column label).
gt_tbl <- sza |> dplyr::filter( latitude == 20 & month == "jan" & !is.na(sza) ) |> dplyr::select(-latitude, -month) |> gt() |> data_color( columns = sza, palette = c("white", "yellow", "navyblue"), domain = c(0, 90) ) |> tab_footnote( footnote = "Color indicates height of sun.", locations = cells_column_labels( columns = sza ) ) |> tab_footnote( footnote = " The true solar time at the given latitude and date (first of month) for which the solar zenith angle is calculated. ", locations = cells_column_labels( columns = tst ) ) |> cols_width(everything() ~ px(150)) gt_tbl
If you decide that you don't want the footnotes in the gt_tbl
object,
they can be removed with rm_footnotes()
.
rm_footnotes(data = gt_tbl)
Individual footnotes can be selectively removed. Footnotes are identified by
their index values. To remove the footnote concerning true solar time
(footnote 2
, since it was supplied to gt after the other footnote) we
would give the correct index value to footnotes
.
rm_footnotes(data = gt_tbl, footnotes = 2)
7-4
v0.8.0
(November 16, 2022)
Other part removal functions:
rm_caption()
,
rm_header()
,
rm_source_notes()
,
rm_spanners()
,
rm_stubhead()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.