Merge and stack text from two columns in gt
and color one with team colors
Source: R/gt_helpers.R
gt_merge_stack_team_color.Rd
The gt_merge_stack_team_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.
Top text is in all caps while the lower text is bigger, bolded,
and colored by the team name in another column.
This is a slightly modified version of gtExtras::gt_merge_stack()
written by Tom Mock.
Arguments
- gt_object
An existing gt table object of class
gt_tbl
- col1
The column to stack on top.
- col2
The column to merge and place below with the text team color that corresponds to
team_col
.- team_col
The column of team abbreviations (cleaned with
clean_team_abbrs()
) that matchvalid_team_names()
for the color of the bottom text.- font_sizes
the font size for the top and bottom text in px. Can be vector of length 1 or 2. Defaults to c(12, 14)
- font_weights
the font weight of the top and bottom text. Can be vector of length 1 or 2. Defaults to c("lighter", "bold")
- font_variants
the font variant of the top and bottom text. Can be vector of length 1 or 2. Defaults to "small-caps"
- color
The color for the top text.