Exploring Categorical Features
Categorical features differ from numeric or continuous features in nature, and therefore the traditional methods used earlier aren't applicable here. We can analyze the number of different classes within a categorical variable and the frequency associated with each. This can be achieved using either simple analytical techniques or visual techniques. Let's explore a list of categorical features using a combination of both.
Exercise 24: Exploring Categorical Features
In this exercise, we will start with a simple variable, that is, marital, which indicates the marital status of the client. Let's use the dplyr library to perform grouped data aggregation.
Perform the following steps to complete the exercise:
First, import the dplyr library in the system using the following command:
library(dplyr)
Next, we will create an object named marital_distribution and store the value based on the following condition:
marital_distribution <- df %>% group_by(marital) %>% ...