The tab_style_by_grp
function takes an existing gt_tbl
object and
styling according to each group. Currently it support styling the max()
/min()
for each group.
tab_style_by_grp(gt_object, column, fn, ...)
An object of class gt_tbl
.
library(gt)
df_in <- mtcars %>%
dplyr::select(cyl:hp, mpg) %>%
tibble::rownames_to_column() %>%
dplyr::group_by(cyl) %>%
dplyr::slice(1:4) %>%
dplyr::ungroup()test_tab <- df_in %>%
gt(groupname_col = "cyl") %>%
tab_style_by_grp(mpg, fn = max,
cell_fill(color = "red", alpha = 0.5))
2-12
Other Utilities:
add_text_img()
,
fa_icon_repeat()
,
fmt_pad_num()
,
fmt_pct_extra()
,
fmt_symbol_first()
,
generate_df()
,
gt_add_divider()
,
gt_badge()
,
gt_double_table()
,
gt_duplicate_column()
,
gt_fa_column()
,
gt_fa_rank_change()
,
gt_fa_rating()
,
gt_fa_repeats()
,
gt_highlight_cols()
,
gt_highlight_rows()
,
gt_img_border()
,
gt_img_circle()
,
gt_img_multi_rows()
,
gt_img_rows()
,
gt_index()
,
gt_merge_stack_color()
,
gt_merge_stack()
,
gt_two_column_layout()
,
gtsave_extra()
,
img_header()
,
pad_fn()