convert numeric value to size
asSize(
x,
humanFriendly = TRUE,
digits = 3,
abbreviateUnits = TRUE,
unitType = "bytes",
unitAbbrev = gsub("^(.).*$", "\\1", unitType),
kiloSize = 1024,
sep = " ",
...
)
numeric vector
logical, currently only TRUE is accepted, whether to include human-friendly units to the output.
integer number of digits used by format
when
formatting the number to create a character string
logical whether to print abbreviated units, for example using k, M, G, T, P instead of kilo, mega, Giga, Tera, Peta, respectively.
character string indicating the base unit of measure, by default "bytes". Note that trailing "s" is removed when the number is singular.
character string indicating an abbreviated base unit,
by default it uses the first character from unitType
.
numeric number of base units when converting from one base unit, to one "kilo" base unit. For file sizes, this value is 1024, but for other purposes this value may be 1000.
delimiter used between the numeric value and the unit.
other parameters passed to format
.
character
vector representing human-friendly sizes.
This function is intended to provide the inverse of asSize()
by converting an abbreviated size into a full numeric value.
It makes one simplifying assumption, that the first character in the unit is enough to determine the unit. This assumption also means the units are currently case-sensitive.
Other jam string functions:
breaksByVector()
,
cPasteSU()
,
cPasteS()
,
cPasteUnique()
,
cPasteU()
,
cPaste()
,
fillBlanks()
,
formatInt()
,
gsubOrdered()
,
gsubs()
,
makeNames()
,
mixedOrder()
,
mixedSortDF()
,
mixedSorts()
,
mixedSort()
,
mmixedOrder()
,
nameVectorN()
,
nameVector()
,
padInteger()
,
padString()
,
pasteByRowOrdered()
,
pasteByRow()
,
sizeAsNum()
,
tcount()
,
ucfirst()
,
uniques()