fmt_pad_num | R Documentation |
This function removes repeating trailing zeroes and adds blank white space to align at the decimal point.
fmt_pad_num(gt_object, columns, sep = ".", nsmall = 2, pad0 = FALSE)
gt_object |
An existing gt table object of class |
columns |
The columns to format. Can either be a series of column names provided in |
sep |
A character for the separator, typically |
nsmall |
The max number of decimal places to round at/display |
pad0 |
A logical, indicating whether to pad the values with trailing zeros. |
An object of class gt_tbl
.
2-2
pad_fn()
Other Utilities:
add_text_img()
,
fa_icon_repeat()
,
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()
,
tab_style_by_grp()
library(gt)
padded_tab <- data.frame(numbers = c(1.2345, 12.345, 123.45, 1234.5, 12345)) %>%
gt() %>%
fmt_pad_num(columns = numbers, nsmall = 4)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.