The Pipe Operator
Look at how the pipe operator is used in data wrangling.
We'll cover the following...
Needed packages
Let’s load all the packages needed.
Press + to interact
library(dplyr)library(ggplot2)library(nycflights13)
Before we start data wrangling, let’s first introduce a tool that gets loaded with the dplyr
package—the pipe operator %>%
. The pipe operator allows us to combine multiple operations in R into a single sequential chain of actions. Let’s start with a hypothetical example. Say we’d like to perform a hypothetical sequence of operations on a hypothetical data frame x
using hypothetical functions f()
, g()
, and h()
:
Take
x
...