The fmt() function

Use the exibble dataset to create a gt table. We’ll format the numeric values in the num column with fmt(). We supply a functions to the fns argument. This supplied function will take values in the column (x), multiply them by 1000, and exclose them in single quotes.

exibble |>
  dplyr::select(-row, -group) |>
  gt() |>
  fmt(
    columns = num,
    fns = function(x) {
      paste0("'", x * 1000, "'")
    }
  )
num char fctr date time datetime currency
'111.1' apricot one 2015-01-15 13:35 2018-01-01 02:22 49.950
'2222' banana two 2015-02-15 14:40 2018-02-02 14:33 17.950
'33330' coconut three 2015-03-15 15:45 2018-03-03 03:44 1.390
'444400' durian four 2015-04-15 16:50 2018-04-04 15:55 65100.000
'5550000' NA five 2015-05-15 17:55 2018-05-05 04:00 1325.810
'NA' fig six 2015-06-15 NA 2018-06-06 16:11 13.255
'7.77e+08' grapefruit seven NA 19:10 2018-07-07 05:22 NA
'8.88e+09' honeydew eight 2015-08-15 20:20 NA 0.440