pipe: Forward-pipe Operator Using Standard Evaluation

Description Usage Arguments Value Examples

Description

The forward pipe operator behaves similar to the magrittr pipe operator with two exceptions. First, it only supports standard evaluation. If modified parameter values are needed then the 'fc' function should be used. Second, it composes functions. The return type of this operator is an R function.

Usage

1
lhs %>% rhs

Arguments

lhs

the function that will be applied second to an input.

rhs

the function that will be applied first to an input.

Value

The composed function lhs(rhs(x)).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# Create a new code block in case the pipe operator is already
# defined.
{
  # Make sure the example uses the correct pipe operator.
  `%>%` <- fc::`%>%`

 # Create a function that gets the 9th and 10th objects using the head
 # and tail functions.
 nine_and_ten <- fc(head, n=10) %>% fc(tail, n=2)
 nine_and_ten(iris)
}

fc documentation built on May 1, 2019, 8:40 p.m.

Related to pipe in fc...