signs_format {signs} | R Documentation |
A function factory to add proper minus signs
Description
Returns a function that will format numeric vectors with proper minus signs.
Usage
signs_format(
...,
format = getOption("signs.format", scales::number),
add_plusses = getOption("signs.add.plusses", FALSE),
trim_leading_zeros = getOption("signs.trim.leading.zeros", FALSE),
label_at_zero = getOption("signs.label.at.zero", "none")
)
Arguments
... |
Other arguments passed on to |
format |
Any function that takes a numeric vector
and returns a character vector,
such as |
add_plusses |
Logical. Should positive values have plus signs? |
trim_leading_zeros |
Logical. Should |
label_at_zero |
Character. What should be returned
when |
Details
See signs
for details.
Value
A function that takes a numeric vector
and returns a UTF-8
character vector
Examples
x <- seq(-5, 5)
scales::number(x)
f1 <- signs_format()
f1(x)
f2 <- signs_format(accuracy = 1, scale = 1, format = scales::percent)
f2(x)
f3 <- signs_format(add_plusses = TRUE)
f3(x)
f4 <- signs_format(add_plusses = TRUE, label_at_zero = "blank")
f4(x)
f5 <- signs_format(add_plusses = TRUE, label_at_zero = "symbol")
f5(x)
f6 <- signs_format(accuracy = .1, scale = .1, trim_leading_zeros = TRUE)
f6(x)
[Package signs version 0.1.2 Index]