Description Usage Arguments Details Value Examples
Applies Match to each individual object within the input rather than matching the entire object.
1 |
x |
a vector (including list) or expression object |
... |
conditions and expressions for matching. See |
See Match for details on condition implementation. Default conditions using the
period . are highly recommended to prevent error.
Matchply is a wrapper to lapply and sapply, depending on the input object,
with ... converted to a match statement for easy use.
vector depending on input x. By default, sapply is
used with simplify = TRUE. This could return a vector, matrix, list,
etc. When simplify = FALSE or a list is provided, the result will be
a list.
1 2 3 4 5 6 7 8 9 10 11 12 13 | new_list <- list(
hello = "World!",
nice = 2,
meet = "u"
)
Matchply(
new_list,
is.numeric -> "found a number!",
"{rld}" -> "maybe found 'World'!",
"u" | "z" -> "found a letter",
. -> "found nothing"
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.