pipe: Pipe operator

Description Arguments See Also Examples

Description

This package uses the pipe operator (%>%) to turn code into a series of imperative procedures.

Arguments

lhs, rhs

An object and a function.

See Also

%>%, 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()

prioritizr/prioritizrutils documentation built on May 25, 2019, 12:20 p.m.