From the course: Learning the R Tidyverse

Unlock the full course today

Join today to access over 24,100 courses taught by industry experts.

Use tidy-select functions to work with many columns at once

Use tidy-select functions to work with many columns at once - R Tutorial

From the course: Learning the R Tidyverse

Use tidy-select functions to work with many columns at once

- [Instructor] Tidy selection is one of the superpowers provided by the tidyverse. Let's take a look at exactly what tidy selection is and how we can use it in a tidy select the R script in the 0603B project. So as per usual, let's load the tidyverse. That's going to give us the core tidyverse packages and tidy selection. In lines three through four we're going to make use of the select verb, and we are using tidy selection here to refer to the columns name through order. So that colon is tidy selection. Where is also a tidy selection helper. This allows us to target columns that meet a specific condition. So if we run lines nine through 10, that's going to return me the name column and all of the columns containing numeric data. Lines 14 and 15 I'm making use of the contains tidy selection helper to target all of the columns that contain the substring sleep. Now I want to show you the documentation for select. So let's highlight that function name and press F1. I'll make the…

Contents