Insert an alert icon to a specific column
gt_alert_icon(
gt_object,
column,
palette = c("#a962b6", "#f1f1f1", "#378e38"),
domain = NULL,
height = "10px",
direction = 1,
align = "center",
v_pad = -5
)
a gt table
An existing gt table object of class gt_tbl
The column wherein the numeric values should be replaced with circular alert icons.
The colours or colour function that values will be mapped to. Can be a character vector (eg c("white", "red")
or hex colors) or a named palette from the {paletteer}
package in the package::palette_name
structure.
The possible values that can be mapped. This should be a simple numeric range (e.g. c(0, 100)
)
A character string indicating the height in pixels, like "10px"
The direction of the paletteer
palette, should be either -1
for reversed or the default of 1
for the existing direction.
Character string indicating alignment of the column, defaults to "left"
A numeric value indicating the vertical padding, defaults to -5 to aid in centering within the vertical space.
head(mtcars) %>%
dplyr::mutate(warn = ifelse(mpg >= 21, 1, 0), .before = mpg) %>%
gt::gt() %>%
gt_alert_icon(warn)