tests/gt-examples/01-html-script/html-05-airquality.R

library(gt)

# Create a display table based on `airquality`
airquality_tbl <-
  gt(airquality) %>%
  cols_move_to_start(columns = c(Month, Day)) %>%
  cols_label(Solar.R = html("Solar<br>Radiation")) %>%
  fmt_number(
    columns = Wind,
    decimals = 2
  ) %>%
  tab_spanner(
    label = "Measurement Period",
    columns = c(Month, Day)
  ) %>%
  sub_missing(columns = c(Ozone, Solar.R, Wind, Temp))

airquality_tbl
rstudio/gt documentation built on Nov. 2, 2024, 5:53 p.m.