Using dplyr's filter function to pick rows from a data frame in R (CC161)

November 8, 2021 • PD Schloss • 1 min read

R’s filter function allows you to create queries to pick rows from a data frame that match your query. It’s a tremendously powerful function that we get from the dplyr R package. In this episode we’ll see how we can use it to search through a data frame with more than 100000 rows! You can make simple and more sophisticated queries by following a few simple concepts. We’ll also see how you can remove NA values using these concepts and using the special drop_na function. I’ll demonstrate how to use filter with a massive data frame that we downloaded from Our World in Data that describes COVID-19 vaccination rates by country and day. In this episode, Pat uses filter and drop_na from the dplyr R package in Rstudio.

Code

You can browse the state of the repository at the