View source: R/gt_image_rows.R
gt_img_rows | R Documentation |
gt
tableThe gt_img_rows
function takes an existing gt_tbl
object and
converts filenames or urls to images into inline images. This is a wrapper
around gt::text_transform()
+ gt::web_image()
/gt::local_image()
with
the necessary boilerplate already applied.
gt_img_rows(gt_object, columns, img_source = "web", height = 30)
gt_object |
An existing gt table object of class |
columns |
The columns wherein changes to cell data colors should occur. |
img_source |
A string, specifying either "local" or "web" as the source of the images. |
height |
The absolute height (px) of the image in the table cell. |
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)) logo_table <- team_df %>% dplyr::select(team_wordmark, team_abbr, logo = team_logo_espn, team_name:team_conf) %>% head() %>% gt() %>% gt_img_rows(columns = team_wordmark, height = 25) %>% gt_img_rows(columns = logo, img_source = "web", height = 30) %>% tab_options(data_row.padding = px(1))
2-7
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_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.