Using the select function and its helper functions in R to pick columns from a data frame (CC160)

November 4, 2021 • PD Schloss • 1 min read

I have a data frame with 65 columns, but only want 4 of those. What am I to do? This is a great place to use the select function and its helper fuctions from the R dplyr package. Pat will show how to use the select function to get columns you want by their name along with the starts_with, ends_with, contains, and matches helper function when you aren’t certain of the column names you want. We’ll also see how you can use the select function to rename columns. We will practice these tools with a massive data frame that we downloaded from Our World in Data that describes COVID-19 vaccination rates by country and day.

Code

You can browse the state of the repository at the