If you have one or more footnotes that ought to be removed, the rm_footnotes() function 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.

## Usage

rm_footnotes(data, footnotes = everything())

## Arguments

data

A table object of class gt_tbl.

footnotes

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 1). A select helper can also be used and, by default, this is everything() (whereby all footnotes will be removed).

## Value

An object of class gt_tbl.

## Examples

Use sza to create a gt table. Color the sza column using the data_color() function, 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,
colors = scales::col_numeric(
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 the rm_footnotes() function.

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)

## Function ID

6-4

Other part removal functions: rm_caption(), rm_header(), rm_source_notes(), rm_spanners(), rm_stubhead()