The rm_footnotes() function

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
tst1 sza2
0700 84.9
0730 78.7
0800 72.7
0830 66.1
0900 61.5
0930 56.5
1000 52.1
1030 48.3
1100 45.5
1130 43.6
1200 43.0
1 The true solar time at the given latitude and date (first of month) for which the solar zenith angle is calculated.
2 Color indicates height of sun.

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)
tst sza
0700 84.9
0730 78.7
0800 72.7
0830 66.1
0900 61.5
0930 56.5
1000 52.1
1030 48.3
1100 45.5
1130 43.6
1200 43.0

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)
tst sza1
0700 84.9
0730 78.7
0800 72.7
0830 66.1
0900 61.5
0930 56.5
1000 52.1
1030 48.3
1100 45.5
1130 43.6
1200 43.0
1 Color indicates height of sun.