ish: Print a plus/minus character.

Description Usage Arguments Value Examples

View source: R/symbols.R

Description

Print a plus/minus character.

Usage

1
2
ish(margin = "", x = "", format = NA, margin_format = format,
  parentheses = FALSE, contract = FALSE)

Arguments

margin

The number after the plus/minus. Can be a character.

x

The number, if any, before the plus/minus. Can be a character.

format

Function. If provided, formats x.

margin_format

Function. If provided, formats margin.

parentheses

Logical. Should margin be wrapped in parentheses?

contract

Logical. If x is provided, should spaces be removed?

Value

Character. x plus or minus a margin (UTF-8).

ish uses glue, so you can use curly bracket notation in x and margin, just like with glue.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
library(scales)
ish()
ish("5%")
ish(.05, format = percent_format(accuracy = 1))
ish(
  x = 100,
  margin = .05,
  margin_format = percent_format(accuracy = 1),
  parentheses = TRUE
)
ish(
  x = 1e3,
  margin = .05,
  format = comma,
  margin_format = percent_format(accuracy = 1),
  parentheses = TRUE
)
ish(x = 5, margin = 5)
ish(x = 5, margin = 5, contract = TRUE)

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