Create a format locale. This object provides information on the
symbols for decimal points, group (thousands) seperator, group sizes, currency symbols,
and numerals to be used in formatting numbers.
fmt_locale(decimal_mark = ".", grouping_mark = ",", grouping = 3,
currency = c("$", ""), numerals = NULL, inf_mark = "Inf",
na_mark = "NA", nan_mark = "NaN")
fmt_default_locale()
Arguments
- decimal_mark
- string. the decimal point mark (e.g., `"."``).
- grouping_mark
- string. the grouping mark (e.g., `","``).
- grouping
- numeric vector group sizes (e.g., c(3L)). It is recycled as needed.
- currency
- character vector of length two with the currency prefix and suffix (e.g., `c("$", "")`
- numerals
- A character vector of length ten to replace the numerals 0-9.
If named, the names must be `"0"`, ..., `"9"`. If not named, then the
vector is assumed to be ordered 0 to 9; e.g. `numerals[1]` is the numeral
for "0", `numerals[2]` is the numeral for "1" and so on.
- inf_mark
- Character: Mark to use for infinity (
Inf).
- na_mark
- Character: Mark to use for missing values, (
NA).
- nan_mark
- Character: Mark to use for not-a-number values, (
NaN).
Value
An object of class `"fmt_locale"`, which is a named list with elements: `decimal`, `thousands`, `grouping`, `currency`, and `numerals` (optional).
Details
The function `fmt_default_locale` returns the default locale.
The defaults are chosen to match R (i.e. US English).
The default locale is set with the option, `fivemat.fmt_default_locale`.