pl: Pluralise word

View source: R/pl.R

plR Documentation

Pluralise word

Description

Converts a word into a plural (English).

Usage

pl(singular, num, irregular = NULL)

Arguments

singular

Singular form of the word

num

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

irregular

Plural form of the word in the case where it is irregular and needs to be explicitly specified.

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

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

Examples

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/jute documentation built on Jan. 11, 2023, 8:23 a.m.