|
Data Science Desktop Survival Guide
by Graham Williams |
|
|||
Pipes: Tee Pipe |
.
A common use case is to whilst continuing on to assign the dataset
itself to a variable. We will often see the following example.
|
# Demonstrate usage of a tee-pipe.
no_rain <- ds %>% filter(rainfall==0) %T>% print()
The tee-pipe processes the transformed dataset in two ways—once with base::print(), then continuing on with dplyr::select() and base::summary(). The tee-pipe splits the flow in two directions. The second flow continues the sequence of the pipeline. |
|
ds %>%
select(rainfall, min_temp, max_temp, sunshine) %>% filter(rainfall==0) %T>% print() %>% select(min_temp, max_temp, sunshine) %>% summary()
|