pipe: Pipe operator

Description Usage Examples

Description

See magrittr::[\%>\%][magrittr::pipe] for details.

Usage

1
2
3
4
5
lhs %>% rhs

lhs %$% rhs

lhs %T>% rhs

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Quick introduction to pipe operators

x <- 1:5

### %>% the forward operator
x %>% mean()
# is equivalent to
mean(x)

### %T>% the tee operator
x %T>% plot %>% mean()
# it takes left hand side, do something (here a plot)
# then pass it to next function (mean)

### %$% the exposition operator
l <- list(x=x, x2=x^2)
l %$% x
# or
l %$% mean(x2)
# names in l (x and x2) are "exposed" to right hand side

# See magrittr vignette for more!

MomX/Momocs2 documentation built on May 13, 2020, 4:28 a.m.