Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

matchArg

Partial Argument Matching


Description

This is an extensions to match.arg with support for AssertCollection. The behavior is very similar to match.arg, except that NULL is not a valid value for x.

Usage

matchArg(x, choices, several.ok = FALSE, .var.name = vname(x), add = NULL)

Arguments

x

[character]
User provided argument to match.

choices

[character()]
Candidates to match x with.

several.ok

[logical(1)]
If TRUE, multiple matches are allowed, cf. match.arg.

.var.name

[character(1)]
Name of the checked object to print in error messages. Defaults to the heuristic implemented in vname.

add

[AssertCollection]
Collection to store assertions. See AssertCollection.

Value

Subset of choices.

Examples

matchArg("k", choices = c("kendall", "pearson"))

checkmate

Fast and Versatile Argument Checks

v2.0.0
BSD_3_clause + file LICENSE
Authors
Michel Lang [cre, aut] (<https://orcid.org/0000-0001-9754-0393>), Bernd Bischl [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.