Skip to contents

Format value to add a thousand and decimal mark.

Usage

format_num(
  x,
  digits = 2,
  decimal_mark = ".",
  thousand_mark = ",",
  br_mark = FALSE
)

Arguments

x

A numeric vector

digits

A numeric integer single value (default = 2), that will be the number of decimal digits

decimal_mark

A character single value to use as the decimal mark (default = '.')

thousand_mark

A character single value to use as the thousand mark (default = ',')

br_mark

A boolean value, if TRUE the function will set decimal_mark = ',' and thousand_mark = '.' (default = FALSE)

Value

A character vector with the formatted vector.

Examples


format_num(12345.67)
#> [1] "12,345.67"