The fmt_bytes() function

Use exibble to create a gt table. Format the num column to have byte sizes in the decimal standard.

exibble |>
  dplyr::select(num) |>
  gt() |>
  fmt_bytes(columns = num)
num
0 B
2 B
33 B
444 B
5.5 kB
NA
777 kB
8.9 MB

Create a similar table with the fmt_bytes() function, this time showing byte sizes as binary values.

exibble |>
  dplyr::select(num) |>
  gt() |>
  fmt_bytes(
    columns = num,
    standard = "binary"
  )
num
0 B
2 B
33 B
444 B
5.4 KiB
NA
758.8 KiB
8.5 MiB