pkgdown/extra.css Skip to contents

Converts raw byte counts into human-readable strings (e.g. "1.23 MB").

Usage

format_bytes(x)

Arguments

x

Numeric vector of byte sizes.

Value

A character vector with formatted sizes.

Examples

format_bytes(c(1024, 1048576, NA))
#> [1] "1 KB" "1 MB" NA