signs: Add plus signs or proper minus signs

Description Usage Arguments Value Examples

View source: R/symbols.R

Description

The true minus sign (UTF 2212) – neither an em dash, nor an en dash, nor the usual hyphen-minus – is highly underrated. It just makes everything look better! This function builds on the formatting functions from the scales package by replacing the hyphen-minus with a true minus, and adding a plus sign if desired.

Usage

1
signs(..., format = scales::number, plus_sign = FALSE)

Arguments

...

Numeric vector and any other arguments passed to format.

format

Function that formats a numeric vector, such as scales::number, scales::comma, scales::percent, or a function returned by scales::unit_format (all of which are documented at number_format).

plus_sign

Logical. Should positive values start with plus signs?

Value

A UTF-8 character vector

Examples

1
2
3
signs(seq(-5, 5))
signs(seq(-5, 5), plus_sign = TRUE)
signs(seq(-5, 5) / 100, format = scales::percent, plus_sign = TRUE)

BenjaminWolfe/typewritr documentation built on Nov. 23, 2019, 11:18 a.m.