This function formats numeric values with specified rounding and marking options.
# S3 method for numerics
format(
x,
digits = 0,
big.mark = "",
big.interval = 3L,
small.mark = "",
small.interval = 5L,
decimal.mark = getOption("OutDec"),
input.d.mark = decimal.mark,
preserve.width = c("common", "individual", "none"),
zero.print = NULL,
replace.zero = FALSE,
drop0trailing = FALSE,
is.cmplx = NA,
...
)A character vector with formatted numeric values.
A numeric, integer, or logical vector to be formatted.
The number of digits to round to. Defaults to 0.
A character string used as a mark for thousands. Defaults to "".
An integer specifying the interval for the big mark. Defaults to 3.
A character string used as a mark for small intervals. Defaults to "".
An integer specifying the interval for the small mark. Defaults to 5.
A character string used as a decimal mark. Defaults to the value of getOption("OutDec").
The decimal mark to be used for input. Defaults to the value of decimal.mark.
A character string specifying how to preserve the width of the output. Can be "common", "individual", or "none". Defaults to "common".
A character string to be used for printing zero. Defaults to NULL.
A logical value indicating whether to replace zeros with the zero.print value. Defaults to FALSE.
A logical value indicating whether to drop trailing zeros. Defaults to FALSE.
A logical value indicating whether the input is complex. Defaults to NA.
Additional arguments passed to prettyNum.