Description Usage Arguments Value Examples
Syntactic sugar for creating a single-variable function. Can be conveniently used in Match
statements.
1 | lhs %fn% rhs
|
lhs |
symbol used to denote the function argument |
rhs |
expression that is converted to the function body. |
a function
1 2 3 4 5 6 7 8 9 | Match(
"abc",
is.numeric -> -1,
i %fn% grepl("bc", i) -> 0,
is.character -> 1
)
print_sq_log <- i %fn% print(sqrt(log(i)))
print_sq_log(10)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.