From the course: Learning the R Tidyverse
Unlock the full course today
Join today to access over 24,100 courses taught by industry experts.
Using the |> pipe in your code - R Tutorial
From the course: Learning the R Tidyverse
Using the |> pipe in your code
- [Instructor] This video is about the pipe constructed from the pipe character, followed by a right angle bracket, more commonly known as the base R pipe. To use this pipe, you need to be using R version 4.1 or later. You can use this pipe with any function in R including functions from the tidyverse. The pipe is syntactic sugar for rewriting your code. The pipe takes the left-hand side of itself and forces it into the first argument of the right-hand side of itself and runs the resultant code. Let's go over to project 01_06b to see this in action. So I have my script base-r-pipe.R open, and I have some code. Hello World is being piped into rep five, and if I run this code by putting my cursor at the end of this pipe chain and hitting Command + Enter or Control + Enter in Windows, that's going to run the code, and it works successfully without loading any packages because it's the base R pipe. It only works because I'm on a version of R that's after 4.1. How do you know which version…
Contents
-
-
-
What is the tidyverse?2m 22s
-
Installing, loading, and working with the tidyverse packages5m 1s
-
(Locked)
Introducing data.frame and tibbles8m 34s
-
What are %>% and |> for in the tidyverse3m 46s
-
(Locked)
Using the %>% pipe in your code5m
-
(Locked)
Using the |> pipe in your code6m 18s
-
(Locked)
Datasets built into the tidyverse packages3m 15s
-
(Locked)
Using the select() function to obtain columns from data4m 23s
-
(Locked)
Using the filter() function to filter data by conditions6m 10s
-
(Locked)
Using the mutate() function to modify and add columns4m
-
(Locked)
Challenge: Rewrite this code to use the pipe of your choice2m 38s
-
(Locked)
Solution: Rewrite this code to use the pipe of your choice3m 19s
-
-
-
-
-
-
-