# NOT RUN {
# Use `sza` to create a gt table; color
# the `sza` column using the `data_color()`
# function, add a footnote and also style
# the footnotes section
tab_1 <-
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_options(table.width = px(320)) %>%
tab_style(
style = list(
cell_text(size = "smaller"),
cell_fill(color = "gray90")
),
locations = cells_footnotes()
)
# }
Run the code above in your browser using DataLab