Format numbers in Brazilian style with decimal comma and thousand separator. Supports currency and percentage formatting.
Arguments
- x
Numeric vector
- digits
Number of decimal places (default 0)
- percent
Logical. If TRUE, formats as percentage (multiplies by 100, adds % suffix)
- currency
Logical. If TRUE, formats as Brazilian Real currency
- ...
Additional arguments passed to
number
See also
Other utilities:
has_insper_fonts(),
save_insper_plot()
Examples
# Basic number formatting
format_num_br(1234.56, digits = 2)
#> [1] "1.234,56"
# Currency formatting
format_num_br(1234.56, currency = TRUE, digits = 2)
#> [1] "R$ 1.234,56"
# Percentage formatting
format_num_br(0.1234, percent = TRUE, digits = 1)
#> [1] "12,3%"
format_num_br(0.1234, percent = TRUE, digits = 2)
#> [1] "12,34%"
