- 1
- Our first action is embedded the furthest into the nested functions
- 2
- Then the output of “find keys” in the input of “start car” which is nested as well
- 3
- We keep working our way out to “drive”
- 4
- Then we finally park
I want to find my keys, then start my car, then drive to work, then park my car.
Nested
|> vs %>%
%>% is the original pipe in R (requires magrittr package within tidyverse)|> is a newer pipe (started in 2021 and does not require a package)|> since it is generally where the field is headed.Simple: when the receiving function only has one input argument, we can use:
Complicated: when the receiving function has more input arguments, we need to specify where the piped input goes. We do this with a placeholder:
The placeholder for |> is _
|>)
|> R will look to the next line for where hrs_data is inputted
%>% to |> (keyboard shortcut will use |>)Piping