Today, we are approaching data analysis from a new angle by applying filtering to grouped data frames. We will revisit the grouping of data frames using the dplyr
package and introduce filtering, illustrating these concepts with examples. By the end of this lesson, you will be well-versed in the skills needed to effectively group and filter data.
As a quick recap, dplyr
is a highly influential package for data analysis in R, with key functions like group_by()
at its core. Data frames, which are data tables that can be grouped using the group_by()
function, are essential to our journey. Here is an example of grouping a data frame by the Product
category:
To show how the grouping works, we also calculate the mean quantity for each group, using the summarize
function. The output is:
To filter a grouped data frame in R, we utilize the function, which is part of the package. For instance, let's retain products with a total quantity greater than .
