The cells_stub() function

Using a transformed version of the sza dataset, let’s create a gt table. Color all of the month values in the table stub with tab_style(), using cells_stub() in locations.

sza |>
  dplyr::filter(latitude == 20 & tst <= "1000") |>
  dplyr::select(-latitude) |>
  dplyr::filter(!is.na(sza)) |>
  tidyr::spread(key = "tst", value = sza) |>
  gt(rowname_col = "month") |>
  sub_missing(missing_text = "") |>
  tab_style(
    style = list(
      cell_fill(color = "darkblue"),
      cell_text(color = "white")
      ),
    locations = cells_stub()
  )
0530 0600 0630 0700 0730 0800 0830 0900 0930 1000
jan


84.9 78.7 72.7 66.1 61.5 56.5 52.1
feb

88.9 82.5 75.8 69.6 63.3 57.7 52.2 47.4
mar

85.7 78.8 72.0 65.2 58.6 52.3 46.2 40.5
apr
88.5 81.5 74.4 67.4 60.3 53.4 46.5 39.7 33.2
may
85.0 78.2 71.2 64.3 57.2 50.2 43.2 36.1 29.1
jun 89.2 82.7 76.0 69.3 62.5 55.7 48.8 41.9 35.0 28.1
jul 88.8 82.3 75.7 69.1 62.3 55.5 48.7 41.8 35.0 28.1
aug
83.8 77.1 70.2 63.3 56.4 49.4 42.4 35.4 28.3
sep
87.2 80.2 73.2 66.1 59.1 52.1 45.1 38.1 31.3
oct

84.1 77.1 70.2 63.3 56.5 49.9 43.5 37.5
nov

87.8 81.3 74.5 68.3 61.8 56.0 50.2 45.3
dec


84.3 78.0 71.8 66.1 60.5 55.6 50.9