grattan_percent: English prose for small numbers

Description Usage Arguments Value Examples

Description

When a small number is requested inline, it is often preferable to use an English expression rather than the numeral. Further, referential purity can be lost when numbers are transformed to suit printing (say by multiplying by 100 to use 'per cent'). A complement to texNum.

These functions are all of the form grattan_* to avoid namespace clashes.

Usage

1
grattan_percent(number, digits = 1, .percent.suffix = "~per~cent")

Arguments

number

A length-one numeric vector.

digits

Passed to scales::comma.

.percent.suffix

What to use for the suffix of the number.

Value

For grattan_percent, the number multiplied by 100, with rounding provided by scales::comma and then the suffix.

Examples

1
grattan_percent(2/3, digits = 0)

HughParsonage/grattanCharts documentation built on May 8, 2019, 10:52 a.m.