trend_terms() returns a list object describing the values to display when x is greater than y or x is less than y.

trend_terms(more = "increase", less = "decrease")

Arguments

more

string to use when x > y

less

string to use when x < y

Value

Returns a list object.

Details

trend_terms() will primarily be used in headline() and passed along to compare_conditions(). Similar to plural_phrasing() Trend terms can be passed in a list. See examples below.

See also

Examples


headline(
  x = c(9, 11),
  y = 10,
  headline = "{trend} by {delta_p}%",
  trend_phrases = trend_terms("higher", "lower")
)
#> lower by 10%
#> higher by 10%

# 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")
    )
)
#> We had an increase of 5 people.
#> That is 5 more employees than the same time last year (35 vs. 30).