View source: R/fontawesome-icons.R
gt_fa_column | R Documentation |
{fontawesome}
icons inside a {gt}
column.The gt_fa_column
function takes an existing gt_tbl
object and
adds specific fontawesome
icons based on what the names in the column are.
The icons are colored according to a palette that the user supplies, either
a vector of valid colors/hex colors of length equal to the unique levels.
gt_fa_column(
gt_object,
column,
...,
palette = NULL,
align = "left",
direction = 1,
height = "20px"
)
gt_object |
An existing gt table object of class |
column |
The column wherein the character strings should be replaced with their corresponding |
... |
Additional arguments passed to |
palette |
Name of palette as a string. Must be either length of 1 or a vector of valid color names/hex values of equal length to the unique levels of the column (ie if there are 4 names, there need to be 4x colors). Note that if you would like to specify a specific color to match a specific icon, you can also use a named vector like: |
align |
Character string indicating alignment of the column, defaults to "left" |
direction |
The direction of the |
height |
A character string indicating the height of the icon, defaults to "20px" |
An object of class gt_tbl
.
library(gt) fa_cars <- mtcars %>% head() %>% dplyr::select(cyl, mpg, am, gear) %>% dplyr::mutate(man = ifelse(am == 1, "gear", "gears")) %>% gt() %>% gt_fa_column(man)
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_duplicate_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()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.