Hi all,
When I run the code below to make an html table with gt
, the images appear fine in Rstudio's viewer, but when I run them through as_raw_html
, the images disappear from the table when you look at the html. Any idea what I'm doing wrong? Is this a bug in gt
?
This also happens when I use local_image
. Curiously, it doesn't happen when I add inline_css = FALSE
to as_raw_html
.
Thanks in advance! Any help would be appreciated,
Ben
library(gt)
library(tidyverse)
standings_table <-
dplyr::tibble(
pixels = px(seq(10, 35, 5)),
image = seq(10, 35, 5)
) %>%
gt() %>%
text_transform(
locations = cells_body(columns = image),
fn = function(x) {
web_image(
url = "https://www.mlbstatic.com/team-logos/142.svg",
height = as.numeric(x)
)
}
)
standings_table
standings_table_html <- as_raw_html(standings_table)
standings_table_html