makeup_num | R Documentation |
This function formats a numeric vector with custom prefixes and suffixes, and optionally with SI prefixes such as "k" for kilo and "M" for mega. The function uses the scales
and d3.format
packages to format the values with custom separators, number of decimal places, and locale settings.
makeup_num(
v,
sample = NULL,
locale = NULL,
prefix = "",
suffix = "",
si_prefix = FALSE,
scale = 1
)
v |
A numeric vector to format. |
sample |
A sample vector with the same data type and range as |
locale |
A character string specifying the locale settings to use. If not specified, the default locale will be used. |
prefix |
A character string to prepend to each formatted value. |
suffix |
A character string to append to each formatted value. |
si_prefix |
A logical value indicating whether to use SI prefixes such as "k" and "M" to format the values. If |
scale |
A numeric value indicating the scale factor to apply when using SI prefixes. For example, a value of 1000 would use "k" for values above 1000, "M" for values above 1,000,000, etc. |
A character vector of formatted values.
makeup_num(1000000, sample = "1234", si_prefix = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.