byte_format: Bytes formatter: convert to byte measurement and display...

Description Usage Arguments Value References Examples

Description

Bytes formatter: convert to byte measurement and display symbol.

Usage

1
2
3
4
5
6
7
8
9
byte_format(symbol = "auto", units = "binary")

Kb(x)

Mb(x)

Gb(x)

bytes(x, symbol = "auto", units = c("binary", "si"))

Arguments

symbol

byte symbol to use. If "auto" the symbol used will be determined by the maximum value of x. Valid symbols are "b", "K", "Mb", "Gb", "Tb", "Pb", "Eb", "Zb", and "Yb", along with their upper case equivalents and "iB" equivalents.

units

which unit base to use, "binary" (1024 base) or "si" (1000 base) for ISI units.

x

a numeric vector to format

Value

a function with three parameters, x, a numeric vector that returns a character vector, symbol the byte symbol (e.g. "Kb") desired and the measurement units (traditional binary or si for ISI metric units).

References

Units of Information (Wikipedia) : http://en.wikipedia.org/wiki/Units_of_information

Examples

1
2
3
4
5
byte_format()(sample(3000000000, 10))
bytes(sample(3000000000, 10))
Kb(sample(3000000000, 10))
Mb(sample(3000000000, 10))
Gb(sample(3000000000, 10))

ggalt documentation built on May 2, 2019, 7:31 a.m.