shelf1=c(10,6,1,3,2,11,15,10,11,6,2,3,0,0,0,3,3,3,8)

median(shelf1)
## [1] 3
mean(shelf1)
## [1] 5.105
hist(shelf1,
     col="red",
     main="Shelf 1",
     xlab="Sugar Content in Cereal")

plot of chunk unnamed-chunk-1

The graph is skewed to the right. The mean is at 5.1 which makes sense because thats in the middle of the graph. The median is at 3 which is where a lot of the data lies in just a few bars on the left of the graph. The median is the middle number in a data set do if there is a large frequency of one number then the median is close to that number.

shelf2=c(14,12,9,13,12,13,0,13,7,12,9,11,3,6,12,3,9,12,15,5,12)

median(shelf2)
## [1] 12
mean(shelf2)
## [1] 9.619
hist(shelf2,
     col="green",
     main="Shelf 2",
     xlab="Sugar Content in Cereal")

plot of chunk unnamed-chunk-2

This graph is skewed to the left. The mean is at 9.6 sugar content which makes sense because the shelf 2 is closer to the reach of kids and is going to have more kinds of cereal with high amounts of sugar.The median is 12 which is where a majority of the data lies.

shelf3=c(6,8,5,0,8,8,5,7,7,3,10,5,10,5,3,4,6,9,1,1,13,7,2,10,14,3,0,0,6,8,6,14,3,3,12)

median(shelf3)
## [1] 6
mean(shelf3)
## [1] 6.057
hist(shelf3,
     col="purple",
     main="shelf 3",
     xlab="Sugar Content in Cereal")

plot of chunk unnamed-chunk-3

This graph has almost an uniform shape. The mean is at 6 which is almost completely in the middle of the graph which shows there wasn’t a huge variation in the frequencys of the cereal for each different sugar level.The median is 6 which is very close to the middle of the graph which again shows there wasn’t a huge variation of the data.