| add_text_img | R Documentation |
The add_text_img function takes an existing gt_tbl object and
adds some user specified text and an image url to a specific cell. This is a
wrapper raw HTML strings and gt::web_image(). Intended to be used inside
the header of a table via gt::tab_header().
add_text_img(text, url, height = 30, left = FALSE)
text |
A text string to be added to the cell. |
url |
An image URL
A url that resolves to an image file. |
height |
Height of image
The absolute height of the image in the table cell (in |
left |
A logical TRUE/FALSE indicating if text should be on the left (TRUE) or right (FALSE) |
An object of class gt_tbl.
2-5
Other Utilities:
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_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)
title_car <- mtcars %>%
head() %>%
gt() %>%
gt::tab_header(
title = add_text_img(
"A table about cars made with",
url = "https://www.r-project.org/logo/Rlogo.png"
)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.