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 - 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
-
-
-
-
-
-
-
-
(Locked)
Handling NAs in the tidyverse with drop_na() and replace_na()4m 12s
-
(Locked)
Use case_when() instead of nested if or ifelse()6m 36s
-
(Locked)
Use tidy-select functions to work with many columns at once4m 4s
-
(Locked)
Using across() in mutate() to modify multiple columns at once6m 52s
-
(Locked)
Filtering many columns at once with if_any() and if_all()3m 37s
-
(Locked)
Understanding how the tidyverse evolves and deprecates3m
-
(Locked)
Challenge: Find all love songs remaining below position 80 in the top 101m 3s
-
(Locked)
Solution: Find all love songs remaining below position 80 in the top 103m 38s
-
(Locked)
-