asSize | R Documentation |
convert numeric value or R object to human-readable size
asSize(
x,
digits = 3,
abbreviateUnits = TRUE,
unitType = "bytes",
unitAbbrev = gsub("^(.).*$", "\\1", unitType),
kiloSize = 1024,
sep = " ",
...
)
x |
|
digits |
|
abbreviateUnits |
|
unitType |
|
unitAbbrev |
|
kiloSize |
|
sep |
|
... |
other parameters passed to |
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.
character
vector representing human-friendly size,
based upon the kiloSize
argument to determine whether to
report byte (1024) or scientific (1000) units.
Other jam string functions:
breaksByVector()
,
fillBlanks()
,
formatInt()
,
gsubOrdered()
,
gsubs()
,
makeNames()
,
nameVector()
,
nameVectorN()
,
padInteger()
,
padString()
,
pasteByRow()
,
pasteByRowOrdered()
,
sizeAsNum()
,
tcount()
,
ucfirst()
asSize(c(1, 10,2010,22000,52200))
#> "1 byte" "10 bytes" "2 kb" "21 kb" "51 kb"
# demonstration of straight numeric units
asSize(c(1, 100, 1000, 10000), unitType="", kiloSize=100)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.