Now that we've covered tidy data, there is one more concept that is very common in the tidyverse that we should discuss. This is the pipe (%>%) from the magrittr package. This is similar to the Unix pipe, and it takes the left-hand side of the pipe and applies the right-hand side function to it. Take the following code:
mpg %>% summary()
The preceding code is equivalent to the following code:
summary(mpg)
As another example, look at the following code:
gapminder %>% filter(year > 1960)
The preceding code is equivalent to the following code:
filter(gapminder, year > 1960)
Piping greatly enhances the readability of code that requires several steps to execute. Take the following code:
x %>% f %>% g %>% h
The preceding ...