Skip to contents

Format numbers in Brazilian style with decimal comma and thousand separator. Supports currency and percentage formatting.

Usage

format_num_br(x, digits = 0, percent = FALSE, currency = FALSE, ...)

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

Value

Formatted character vector

See also

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%"