Skip to contents

Message on Missing Elements

Usage

noSuchElements(x, available, type = "element", sorted = TRUE, suffix = "")

Arguments

x

name of element that was not found

available

names of elements that are available

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: TRUE

suffix

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

Examples

cat(kwb.utils:::noSuchElements("x", LETTERS[1:3]))
#> No such element:
#> - 'x'
#> Available elements (sorted):
#> - 'A'
#> - 'B'
#> - 'C'
cat(kwb.utils:::noSuchElements(c("x", "y"), LETTERS[1:3], suffix = "s"))
#> No such elements (sorted)s:
#> - 'x'
#> - 'y'
#> Available elements (sorted):
#> - 'A'
#> - 'B'
#> - 'C'