library(datasetsICR)data(wine)#Convert the 'Class' variable to a factorwine$Class <-as.factor(wine$Class)#First 10 rows, last 10 rows, and the structure of the datasethead(wine, 10)
#Summary statistics for 'Alcohol' and 'Color intensity'summary(wine$Alcohol)
Min. 1st Qu. Median Mean 3rd Qu. Max.
11.03 12.36 13.05 13.00 13.68 14.83
summary(wine$`Color intensity`)
Min. 1st Qu. Median Mean 3rd Qu. Max.
1.280 3.220 4.690 5.058 6.200 13.000
#table for the 'Class' categorical variabletable(wine$Class)
1 2 3
59 71 48
#Chart: Relationship between Alcohol and Color Intensitylibrary(ggplot2)
Warning: package 'ggplot2' was built under R version 4.3.2
ggplot(wine, aes(x = Alcohol, y =`Color intensity`, color = Class)) +geom_point() +labs(x ="Alcohol", y ="Color Intensity", title ="Relationship between Alcohol and Color Intensity in Wine Varieties",subtitle ="Highlighting the Distribution by Wine Class",caption ="Data source: datasetsICR package") +theme_minimal() +scale_color_brewer(type ="qual")
#INSIGHTS
The scatter plot I used provides a visual summary of the relationship between alcohol content and color intensity in wines, broken down by class.
Key takeaways include:
Wine Class 1 tends to have a wider range of alcohol content, roughly between 12.5% to 14.5%, with varying color intensities.
Wine Class 2 generally appears to have a lower alcohol content, mostly concentrated between 12% and 13%, and also exhibits a lower range of color intensity compared to Class 1.
Wine Class 3 shows a more compact grouping in terms of alcohol content, primarily between 13% and 14%, with color intensity spread across a wider range similar to Class 1.
The data suggest some level of relationship between higher alcohol content and color intensity within Class 1, but this trend is not consistent across all classes.
The distribution of points does not strongly support a uniform relationship between alcohol and color intensity across classes, pointing to the complexity of wine characteristics.