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

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