Learn R Programming

cli (version 3.6.4)

no: Pluralization helper functions

Description

Pluralization helper functions

Usage

no(expr)

qty(expr)

Arguments

expr

For no() it is an expression that is printed as "no" in cli expressions, it is interpreted as a zero quantity. For qty() an expression that sets the pluralization quantity without printing anything. See examples below.

See Also

Other pluralization: pluralization, pluralize()

Examples

Run this code
nfile <- 0; cli_text("Found {no(nfile)} file{?s}.")

#> Found no files.

nfile <- 1; cli_text("Found {no(nfile)} file{?s}.")

#> Found 1 file.

nfile <- 2; cli_text("Found {no(nfile)} file{?s}.")

#> Found 2 files.

Run the code above in your browser using DataLab