Other Verbs
Explore important data wrangling verbs such as select, rename, and top_n to transform and manage datasets efficiently. Understand how to choose, reorder, or rename variables and extract top values to streamline data analysis with dplyr and Tidyverse tools.
We'll cover the following...
Here are some other useful data wrangling verbs:
select(): This selects only a subset of variables/columns.rename(): This renames variables/columns to have new names.top_n(): This returns only the top n values of a variable.
Select variables
We’ve seen that the flights data frame in the nycflights13 package contains 19 different variables. We can identify the names of these 19 variables by running the glimpse() function from the dplyr package:
However, say we only need two of these 19 variables—the carrier and flight. We can select() these two variables:
This function makes it easier to explore large datasets because ...