case | R Documentation |
Takes a name (i.e., any atomic scalar) and matches that name to the name matching an element of ...
where matching can be achieved by matching the name of an argument in ...
. When names are supplied via .names
, they substituted for the names of arguments in ...
. When no match is found and .def = 'err'
an error is thrown, otherwise, the value of .def
is returned.
case(.name, ..., .names = NULL, .def = "err")
.name |
|
... |
Any number of uniquely named arguments to select from to be the return value. Selection is based on which element's name equals the value of |
.names |
Either |
.def |
The default value to return if no match is found, unless |
Either the value of an argument selected from ...
or the value of .def
.
Other forks:
fork_help()
,
swap_help()
case("one", one = 1, two = letters, .def = "default")
case("two", one = 1, two = letters, .def = "default")
case("three", one = 1, two = letters, .def = "default")
case("three", 1, letters, .names = c("three", "four"), .def = "default")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.