pl: Pluralize word

Description Usage Arguments Details Value Examples

Description

Converts a word into a plural (English).

Usage

1
pl(singular, num, irregular = NULL)

Arguments

singular

character: singular form of the word.

num

integer: number of items. num = 1 will give the singular form; num = 0 or num > 1 will give the plural form.

irregular

character: plural form of the word if it is irregular and needs to be explicitly supplied.

Details

This function would usually be used in a context where the number of items num is a variable and not known at run-time.

Value

character: singular or plural form of the word, depending on the value of num.

Examples

1
2
3
4
5
6
7
8
pl("shoe", 2)
pl("shoe", 1)

n <- 0
pl("thing", n)

pl("sheep", 5)           # => incorrect (gives "sheeps")
pl("sheep", 5, "sheep")  # => correct   (gives "sheep")

toniprice/jutebag documentation built on May 12, 2019, 4:39 a.m.