<- "https://www.r-project.org/logo/Rlogo.png" r_png_url
The web_image()
function
Get the PNG-based logo for the R Project from an image URL.
Create a tibble that contains heights of an image in pixels (one column as a string, the other as numerical values), then, create a gt table. Use text_transform()
to insert the R logo PNG image with the various sizes.
::tibble(
dplyrpixels = px(seq(10, 35, 5)),
image = seq(10, 35, 5)
|>
) gt() |>
text_transform(
locations = cells_body(columns = image),
fn = function(x) {
web_image(
url = r_png_url,
height = as.numeric(x)
)
} )
pixels | image |
---|---|
10px | |
15px | |
20px | |
25px | |
30px | |
35px |
Get the SVG-based logo for the R Project from an image URL.
<- "https://www.r-project.org/logo/Rlogo.svg" r_svg_url
Create a tibble that contains heights of an image in pixels (one column as a string, the other as numerical values), then, create a gt table. Use tab_header()
to insert the R logo SVG image once in the title and five times in the subtitle.
::tibble(
dplyrpixels = px(seq(10, 35, 5)),
image = seq(10, 35, 5)
|>
) gt() |>
tab_header(
title = html(
"<strong>R Logo</strong>",
web_image(
url = r_svg_url,
height = px(50)
)
),subtitle = html(
web_image(
url = r_svg_url,
height = px(12)
|>
) rep(5)
) )
R Logo | |
pixels | image |
---|---|
10px | 10 |
15px | 15 |
20px | 20 |
25px | 25 |
30px | 30 |
35px | 35 |