visualize_densities.RdThis function provides a user-friendly way to visualize densities of a numeric variable across levels of a categorical variable.
visualize_densities(
cat_var,
num_var,
cat_var_name = "Categorical Variable",
num_var_name = "Numeric Variable",
level_labels = NULL,
xlab = NULL,
main = NULL,
colors = NULL
)The categorical variable.
The numerical variable.
The desired name/label of the categorical variable. If no name is provided, it will default to "Categorical Variable."
The desired name/label of the numeric variable. If no name is provided, it will default to "Numeric Variable."
The desired labels of the levels of the categorical variable. If no labels are provided, the labels will be the values found in the data.
The desired label of the x-axis, a character string.
The desired title, a character string.
The desired colors for the densities, a character vector.
A density plot of the inputted variables.