Min. 1st Qu. Median Mean 3rd Qu. Max.
25.0 742.2 1526.0 3071.9 3554.2 60869.0
summary(customers$Milk)
Min. 1st Qu. Median Mean 3rd Qu. Max.
55 1533 3627 5796 7190 73498
bins <-cut(customers$Frozen, breaks =4, labels =c("Low", "Medium-Low", "Medium-High", "High"))customers$Frozen <-factor(bins)# Tabletable_customers <-table(customers$Frozen)# Scatterplotggplot(customers, aes(x = Frozen, y = Milk, color = Frozen)) +geom_point() +labs(x ="Frozen Variable", y ="Milk Variable", title ="Scatter Plot of Milk vs. Frozen Variables",subtitle ="Relationship between Milk and Frozen Variables with Categorical Levels") +theme(legend.position ="right") +labs(caption ="Data Source: customers dataset")
# Bar Plotagg_data <-aggregate(Milk ~ Frozen, data = customers, FUN = mean)# Plotggplot(agg_data, aes(x = Frozen, y = Milk, fill = Frozen)) +geom_bar(stat ="identity", position ="dodge") +labs(x ="Frozen Variable", y ="Mean Milk", title ="Bar Plot of Mean Milk vs. Frozen Variables",subtitle ="Relationship between Mean Milk and Frozen Variables with Categorical Levels") +theme(legend.position ="right") +labs(caption ="Data Source: customers dataset")
# Violin Plotggplot(customers, aes(x = Frozen, y = Milk, fill = Frozen)) +geom_violin() +labs(x ="Frozen Variable", y ="Milk Variable", title ="Violin Plot of Milk vs. Frozen Variables",subtitle ="Distribution of Milk Values across Frozen Variable Levels") +theme(legend.position ="right") +labs(caption ="Data Source: customers dataset")
# Line plotggplot(agg_data, aes(x = Frozen, y = Milk, group =1)) +geom_line(color ="blue") +geom_point(color ="red") +labs(x ="Frozen Variable", y ="Mean Milk", title ="Line Plot of Mean Milk vs. Frozen Variables",subtitle ="Relationship between Mean Milk and Frozen Variables with Categorical Levels") +theme_minimal() +labs(caption ="Data Source: customers dataset")
The scatter plot visually represents the relationship between the “Milk” and “Frozen” variables, with each dot colored according to the levels of the categorical variable “Frozen.” The x-axis represents the “Frozen” variable, which has been categorized into four levels - “Low,” “Medium-Low,” “Medium-High,” and “High” based on numerical values.The y-axis represents the “Milk” variable, showing the values for each observation. The legend helps identify the color-coding for different levels, providing a clear distinction. The chart suggests whether there is any discernible pattern or trend between the two numeric variables for each category of the “Frozen” variable. The subtitle emphasizes that the primary insight revolves around understanding the relationship between “Milk” and “Frozen” variables across categorical levels.