Skip to content

Instantly share code, notes, and snippets.

@AlbertRapp
Created April 2, 2023 15:20
Show Gist options
  • Save AlbertRapp/68f048ae07649c9ddb7aca504cdc523b to your computer and use it in GitHub Desktop.
Save AlbertRapp/68f048ae07649c9ddb7aca504cdc523b to your computer and use it in GitHub Desktop.
interactive_gt.R
library(gt)
gt::towny |> # new data set in {gt} 0.9.0
dplyr::select(name, land_area_km2) |>
gt() |>
cols_label(name = 'Name', land_area_km2 = 'Area (sq.km)') |>
opt_interactive(
use_search = TRUE, use_filters = TRUE,
use_compact_mode = TRUE, page_size_default = 5
) |>
tab_options(table.width = '500px', container.width = '500px')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment