The function fmt_new creates a function to format numbers using
a given locale and spec. The function fmt formats
numbers, and is a convenience function for fmt_new(...)(x).
fmt_new(spec = NULL, locale = NULL, si_prefix = NULL) fmt(x, spec = NULL, locale = NULL, ...)
fmt_spec object, or a string coerced to a
fmt_spec object using as_fmt_spec, or a list of
arguments passed to fmt_spec.fmt_locale object.NULL, then use
an https://en.wikipedia.org/wiki/Metric_prefix#List_of_SI_prefixes to format x.
If TRUE, then use precision_prefix to automatically determine
the SI prefix to use. Otherwise, it can be any of the valid arguments
for si_prefix: a string with the prefix name, an integer with the
SI prefix exponent, or a numeric value.
Unlike the "s" format type, this applies the same
prefix to all values in x, rather than determining the SI-prefix
on a value by value basis. Additionally, a non-NULL si implies
a "f" format type, in which precision represents the number of
digits past the decimal point.fmt_new.fmt_new returns a function with a single argument.
fmt returns a function of the same length as x of
formatted numbers.
fmt(c(0.00042, 0.0042), spec = ",.0", si_prefix = 1e-6)#> [1] "420μ" "4,200μ"