arrow: Syntax sugar of making an anonymous function

Description Usage Arguments Examples

Description

arrow function can check arguments class.

Usage

1
lhs %->% rhs

Arguments

lhs

formal parameters: any R parsable expression is acceptable, but f(x, y) or {x; y} is recommended.

rhs

body for lambda

Examples

1
2
3
4
5
6
7
{} %->% {x + 2}
x %->% {x + 1}
{x; y} %->% {x + y}
{x = 1L; y = 2L} %->% {x + y}

{x:character; e:environment} %->% {get(x, envir = e, inherits = FALSE)}
# see more examples in https://gist.github.com/TobCap/6826123

TobCap/lambdass documentation built on May 9, 2019, 4:50 p.m.