Skip to contents

Wrapper functions for printing nicely formatted values.

Usage

print_currency(
  x,
  suffix = "",
  big.mark = ",",
  accuracy = NULL,
  prefix = NULL,
  ...
)

print_percent(x, accuracy = 0.1, ...)

Arguments

x

A numeric vector

big.mark

Character used between every 3 digits to separate thousands.

accuracy

A number to round to. Use (e.g.) 0.01 to show 2 decimal places of precision. If NULL, the default, uses a heuristic that should ensure breaks have the minimum number of digits needed to show the difference between adjacent values.

Applied to rescaled data.

prefix, suffix

Symbols to display before and after value.

...

Other arguments passed on to base::format().

Examples

print_currency(2345678, suffix = " PLN")
#> [1] "2,345,678 PLN"
print_percent(0.52366)
#> [1] "52.4%"