The currency() function

Use the exibble dataset to create a gt table. Within the fmt_currency() call, we’ll format the currency column to have currency values in guilder (a defunct Dutch currency). We can register this custom currency with the currency() helper function, supplying the "ƒ" HTML entity for html outputs and using "f" for any other type of gt output.

exibble |>
  gt() |>
  fmt_currency(
    columns = currency,
    currency = currency(
      html = "ƒ",
      default = "f"
    ),
    decimals = 2
  )
num char fctr date time datetime currency row group
1.111e-01 apricot one 2015-01-15 13:35 2018-01-01 02:22 ƒ49.95 row_1 grp_a
2.222e+00 banana two 2015-02-15 14:40 2018-02-02 14:33 ƒ17.95 row_2 grp_a
3.333e+01 coconut three 2015-03-15 15:45 2018-03-03 03:44 ƒ1.39 row_3 grp_a
4.444e+02 durian four 2015-04-15 16:50 2018-04-04 15:55 ƒ65,100.00 row_4 grp_a
5.550e+03 NA five 2015-05-15 17:55 2018-05-05 04:00 ƒ1,325.81 row_5 grp_b
NA fig six 2015-06-15 NA 2018-06-06 16:11 ƒ13.26 row_6 grp_b
7.770e+05 grapefruit seven NA 19:10 2018-07-07 05:22 NA row_7 grp_b
8.880e+06 honeydew eight 2015-08-15 20:20 NA ƒ0.44 row_8 grp_b