Description Usage Arguments Examples
Semantics of %>%
is eager evaluation, the example of magrittr
is not accurate. x %>% f
is not equivalent to f(x)
but equals to
{tmp <- x; f(tmp)}
or {force(x); f(x)}
. demagrittr() converts magrittr's syntax to such eager
evaluation.
1 | demagrittr(expr, is_NSE = TRUE, mode = c("eager", "lazy", "promise"))
|
expr |
expression with magrittr functions such as "%>%" |
is_NSE |
if TRUE, expr is not evaluated. |
mode |
choose one of "eager", "lazy", and "promise". Pipe streams are formed along with such mode. |
1 2 3 4 5 6 7 8 9 10 11 12 13 | demagrittr(x %>% f)
demagrittr(x %>% f(y))
demagrittr(x %>% f %>% g %>% h)
demagrittr(x %>% f(y, .))
demagrittr(x %>% f(y, z = .))
demagrittr(x %>% f(y = nrow(.), z = ncol(.)))
demagrittr(x %>% {f(y = nrow(.), z = ncol(.))})
demagrittr(x %>% f %>% g, mode = "eager") # default
demagrittr(x %>% f %>% g, mode = "lazy")
demagrittr(x %>% f %>% g, mode = "promise")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.