Formats fractions as percentages, i.e. multiplying them by 100 and adding '%'. Respects the timesaveR.round_method option for consistent rounding behavior (see round_() for details).

fmt_pct(x, digits = 1)

Arguments

x

Numeric, or a vector of numbers

digits

Number of significant digits, defaults to 1

Examples

fmt_pct(0.127)
#> [1] "12.7%"
fmt_pct(c(0.127, 0.456, 0.789), digits = 2)
#> [1] "12.70%" "45.60%" "78.90%"