View source: R/plural-phrasing.R
plural_phrasing | R Documentation |
plural_phrasing()
returns a list object describing the value
to use when display when x - y
is 1 (single) or not one (multiple or
fraction). This helps write "1 person" vs "2 people"
plural_phrasing(single, multi)
single |
string to use when delta = 1 |
multi |
string to use when delta > 1 |
plural_phrasing()
will primarily be used in headline()
and
passed along to compare_conditions()
. Similar to trend_terms()
.
Plural phrases can be passed in a list. See examples below.
Returns a list object.
plural_phrasing(single = "person", multi = "people") headline( x = 1:2, y = 0, headline = "a difference of {delta} {people}", plural_phrases = list(people = plural_phrasing("person", "people")) ) # a complex example passing multiple trends and plural phrases headline( 35, 30, headline = "We had {an_increase} of {delta} {people}. That is {delta} {more} {employees} \\ than the same time last year ({orig_values}).", trend_phrases = list( an_increase = trend_terms("an increase", "a decrease"), more = trend_terms("more", "less") ), plural_phrases = list( people = plural_phrasing("person", "people"), employees = plural_phrasing("employee", "employees") ) )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.