The fmt_bytes() function

Use a single column from the exibble dataset and create a simple gt table. We’ll use fmt_bytes() to format the num column to display as byte sizes in the decimal standard.

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

Let’s create an analogous table again by using fmt_bytes(), this time showing byte sizes as binary values by using standard = "binary".

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