mtcars %>%
as_tibble() %>%
select(mpg, cyl, disp) %>%
head(5) %>%
gt() %>%
tab_style(
style = cell_fill(color = "red"),
locations = cells_body(
columns = vars(disp),
rows = disp > mean(disp)
)
) %>%
tab_style(
style = cell_fill(color = "red"),
locations = cells_body(
columns = vars(cyl),
rows = cyl > mean(cyl)
)
) %>%
tab_style(
style = cell_fill(color = "red"),
locations = cells_body(
columns = vars(mpg),
rows = mpg > mean(mpg)
)
)
I want to know if there be a better way to get to my goal, instead of repeating the 'style_tab()' tailored to each column. Help?