cereal<-read.csv("https://raw.githubusercontent.com/kitadasmalley/MATH138/main/HAWKES/Data/cerealDat.csv",
header=TRUE)
How many observations (rows) and variables (columns) are in this dataset?
str(cereal)
List the variables. Make note of which variables are numeric and which are categorical.
mean(cereal$Sugars)
sd(cereal$Sugars)
summary(cereal$Sugars)
What does the relationship between the mean and median tell you about the shape of the distribution?
library(tidyverse)
ggplot(cereal, aes(y=Sugars))+
geom_boxplot()
Sketch the box plot for sugars using the information from Step 4 to annotate the plot.
It is commonly thought that cereals are displayed in certain shelf locations at a market to draw the attention of children. Make a hypothesis about shelf location (Shelf) and the sugar content in a serving of cereal.
cereal%>%
group_by(Shelf)%>%
summarise(avgSug=mean(Sugars, na.rm=TRUE),
medSug=median(Sugars, na.rm=TRUE))
ggplot(cereal, aes(x=Shelf, y=Sugars, fill=Shelf))+
geom_boxplot()
Sketch the graph comparing shelf location and sugars.
Summarize your findings about sugar content in cereals. Does your plot from Step 8 support your hypothesis in Step 6?