x: numeric vector, class object_size which is converted to numeric, any other R object is converted to a single numeric
value using utils::object.size().
digits: integer number of digits used by base::format() when formatting the number to create a character string
abbreviateUnits: logical, default TRUE, whether to print abbreviated units, for example using k, M, G, T, P instead of kilo, mega, Giga, Tera, Peta, respectively.
unitType: character string indicating the base unit of measure, by default "bytes". Note that trailing "s" is removed when the number is singular.
unitAbbrev: character string indicating an abbreviated base unit, by default it uses the first character from unitType.
kiloSize: numeric, default 1024, number of base units when converting from to one "kilo" base unit. For computer-based size such as file size and object size, this value is 1024. For other purposes, such as scientific or monetary numbers, this value should usually be 1000.
sep: delimiter used between the numeric value and the unit, default " ".
...: other parameters passed to base::format().
Returns
character vector representing human-friendly size, based upon the kiloSize argument to determine whether to report byte (1024) or scientific (1000) units.
Details
This function returns human-readable size based upon numeric input. Alternatively, when input is any other R object, it calls utils::object.size() to produce a single numeric value which is then used to produce human-readable size.
The default behavior is to report computer size in bytes, where 1024 is considered "kilo", however argument kiloSize can be used to produce values where kiloSize=1000 which is suitable for monetary and other scientific values.