Skip to content

Instantly share code, notes, and snippets.

@AlbertRapp
Created April 2, 2023 15:18
Show Gist options
  • Save AlbertRapp/12c51b04324228d885046a374673fd48 to your computer and use it in GitHub Desktop.
Save AlbertRapp/12c51b04324228d885046a374673fd48 to your computer and use it in GitHub Desktop.
01_gt_gtExtras_incorporated.R
library(gt)
library(tidyverse)
tribble(
~flag, ~country, ~population,
'DE', 'Germany', 84270625,
'US', 'United States', 333287557,
'IE', 'Italy', 58853482,
'GY', 'Guyana', 795408,
'NO', 'Norway', 5488984,
'GH', 'Ghana', 32103042
) |>
arrange(country) |>
gt() |>
cols_label_with(fn = str_to_title) |>
fmt_flag(columns = flag, height = '50px') |>
fmt_number(population, decimals = 0) |>
data_color(population, palette = "magma")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment