This package uses the pipe operator (%>%
) to express nested code
as a series of imperative procedures.
An object and a function.
magrittr::%>%()
, tee()
.
# set seed for reproducibility
set.seed(500)
# generate 100 random numbers and calculate the mean
mean(runif(100))
#> [1] 0.473179
# 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()
#> [1] 0.473179