Description Usage Arguments Details Value Examples
ref
methods for use with Match
in the matchr
package.
1 2 3 4 5 6 7 8 9 10 11 |
cond |
match condition |
x |
object being matched |
do |
return expression associated with the condition. If |
... |
arguments passed to evaluation |
See Match
for details about the implementation of match_cond
. When matching,
ref
conditions check whether x
is a ref
object. If so, then a match occurs if the condition
and x
point to the same object. Otherwise, the condition is dereferenced and the resulting value
is checked using the appropriate match condition. Note that a slice
is never matched with a
ref
and vice versa, though ref
and sref
objects may match if they
point to the same object.
FALSE
if no match, or a list containing TRUE
and the evaluated expression
1 2 3 4 5 6 7 8 9 | x <- 1:10
ref_to_x <- ref(x)
matchr::Match(
x,
is.character -> "is a character",
ref_to_x -> "same as reference", # <- MATCH
. -> "anything else"
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.