Skip to contents

This function does the same thing as kwb.utils::enumeration(), but it is bundled with ambre to avoid a hard dependency on the unmaintained package.

Usage

enumeration(x, type = "element", sorted = FALSE, suffix = "")

Arguments

x

vector of elements to be enumerated

type

type of element to appear in the message. Default: "element"

sorted

logical. Whether or not to print the available elements in lexical order. Default: FALSE

suffix

suffix to be appended to type. Can be used to distinguish between singular and plural form. Default: ""

Value

character string containing the enumeration

References

Sonnenberg H (2024). kwb.utils: General Utility Functions Developed at KWB. R package version 0.15.0 URL: https://github.com/kwb-r/kwb.utils (MIT Licence)

Examples


# Example usage of enumeration
cat(enumeration(c("a", "b", "c"), type = "element"))
#> elements:
#> - 'a'
#> - 'b'
#> - 'c'
cat(enumeration(c("x", "y"), type = "element", suffix = "s"))
#> elementss:
#> - 'x'
#> - 'y'