
Merge and stack text with background coloring from two columns in gt
Source: R/merge_and_stack.R
gt_merge_stack_color.RdThe gt_merge_stack_color() function takes an existing gt table and merges
column 1 and column 2, stacking column 1's text on top of column 2's.
This variant also accepts a palette argument to colorize the background
values.
Arguments
- gt_object
An existing gt table object of class
gt_tbl- top_val
The column to stack on top. Will be converted to all caps, with bold text by default.
- color_val
The column to merge and place below, and controls the background color value. Will be smaller by default.
- palette
The colours or colour function that values will be mapped to, accepts a string or named palettes from paletteer.
- domain
The possible values that can be mapped. This can be a simple numeric range (e.g.
c(0, 100)).- small_cap
a logical indicating whether to use 'small-cap' on the top line of text, defaults to
TRUE.- font_size
a string of length 2 indicating the font-size in px of the top and bottom text
- font_weight
a string of length 2 indicating the 'font-weight' of the top and bottom text. Must be one of 'bold', 'normal', 'lighter'
See also
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_rank_change(),
gt_fa_rating(),
gt_highlight_cols(),
gt_highlight_rows(),
gt_img_border(),
gt_img_circle(),
gt_img_multi_rows(),
gt_img_rows(),
gt_index(),
gt_merge_stack(),
gt_two_column_layout(),
gtsave_extra(),
img_header(),
pad_fn(),
tab_style_by_grp()
