View source: R/gt_duplicate_column.R
| gt_duplicate_column | R Documentation |
This function takes an existing gt table and will duplicate a column. You also have the option to specify where the column ends up, and what will be appending to the end of the column name to differentiate it.
gt_duplicate_column(
gt_object,
column,
after = dplyr::last_col(),
append_text = "_dupe",
dupe_name = NULL
)
gt_object |
An existing gt table object of class |
column |
The column to be duplicated |
after |
The column to place the duplicate column after |
append_text |
The text to add to the column name to differentiate it from the original column name |
dupe_name |
A full name for the "new" duplicated column, will override |
An object of class gt_tbl.
2-15
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_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_merge_stack_color(),
gt_two_column_layout(),
gtsave_extra(),
img_header(),
pad_fn(),
tab_style_by_grp()
library(gt)
dupe_table <- head(mtcars) %>%
dplyr::select(mpg, disp) %>%
gt() %>%
gt_duplicate_column(mpg, after = disp, append_text = "2")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.