我正在尝试使用 gt 包为每行中具有最大值的单元格着色(即为每个类型的最大值着色)。以下失败:
df <- tibble(Type=c("a","b","c"),V2=c(7:9), V3 = c(9,8,1), V4 = c(12,31,105))
df %>%
gt() %>%
tab_style(
style = list(
cell_fill(color = "#D9654B")
),
locations = cells_body(
columns = vars(V2, V3, V4), # not needed if coloring all columns
rows = max(.))
)
请帮忙出主意。