pipe: Pipe operator

Description Arguments See Also Examples

Description

This package uses the pipe operator (%>%) to express nested code as a series of imperative procedures.

Arguments

lhs, rhs

An object and a function.

See Also

magrittr::%>%(), tee().

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
# set seed for reproducibility
set.seed(500)

# generate 100 random numbers and calculate the mean
mean(runif(100))

# reset the seed
set.seed(500)

# repeat the previous procedure but use the pipe operator instead of nesting
# function calls inside each other.
runif(100) %>% mean()

oppr documentation built on May 12, 2021, 1:07 a.m.