View source: R/merge_and_stack.R
gt_merge_stack | R Documentation |
gt
The gt_merge_stack()
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 with black bold text, while the lower text is smaller
and dark grey.
gt_merge_stack(
gt_object,
col1,
col2,
palette = c("black", "grey"),
...,
small_cap = TRUE,
font_size = c("14px", "10px"),
font_weight = c("bold", "bold")
)
gt_object |
An existing gt table object of class |
col1 |
The column to stack on top. Will be converted to all caps, with black and bold text. |
col2 |
The column to merge and place below. Will be smaller and dark grey. |
palette |
The colors for the text, where the first color is the top ,
ie |
... |
Arguments passed on to
|
small_cap |
a logical indicating whether to use 'small-cap' on the top line of text |
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' |
An object of class gt_tbl
.
library(gt) teams <- "https://github.com/nflverse/nflfastR-data/raw/master/teams_colors_logos.rds" team_df <- readRDS(url(teams)) stacked_tab <- team_df %>% dplyr::select(team_nick, team_abbr, team_conf, team_division, team_wordmark) %>% head(8) %>% gt(groupname_col = "team_conf") %>% gt_merge_stack(col1 = team_nick, col2 = team_division) %>% gt_img_rows(team_wordmark)
2-6
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_two_column_layout()
,
gtsave_extra()
,
img_header()
,
pad_fn()
,
tab_style_by_grp()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.