The fmt_spelled_num() function

Use the gtcars dataset to create a gt table. After some summarizing and arranging of rows, the fmt_spelled_num() function is used to transform integer values into spelled-out numbering (in the n column). That formatted column of numbers-as-words is given cell background colors via data_color() (the underlying numerical values are always available).

gtcars |>
  dplyr::select(mfr, ctry_origin) |>
  dplyr::group_by(mfr, ctry_origin) |>
  dplyr::count() |>
  dplyr::ungroup() |>
  dplyr::arrange(ctry_origin) |>
  gt(rowname_col = "mfr", groupname_col = "ctry_origin") |>
  cols_label(n = "No. of Entries") |>
  fmt_spelled_num() |>
  tab_stub_indent(rows = everything(), indent = 2) |>
  data_color(
    columns = n,
    method = "numeric",
    palette = "viridis",
    alpha = 0.8
  ) |>
  opt_all_caps() |>
  opt_vertical_padding(scale = 0.5) |>
  cols_align(align = "center", columns = n)
No. of Entries
Germany
Audi five
BMW five
Mercedes-Benz two
Porsche four
Italy
Ferrari nine
Lamborghini three
Maserati three
Japan
Acura one
Nissan one
United Kingdom
Aston Martin four
Bentley one
Jaguar one
Lotus one
McLaren one
Rolls-Royce two
United States
Chevrolet one
Dodge one
Ford one
Tesla one