Bar Charts

(from Nicole Radziwill)

For small data sets, you may have already tallied up your observations, and you donโ€™t need to load a whole file in to create your bar chart. Here is an example of data generated by opening one package of regular M&Ms to look at the distribution of colors, working with your data as a vector. The counts are: 12 blue ones, 6 brown ones, 8 green ones, and so forth:

mm.counts <- c(12,6,8,10,6,99)
names(mm.counts) <- c("blue","brown","green","orange",
"red","yellow")
mm.colors <- c("blue","brown","green","orange","red","yellow") # creates a vector of the palette of colors to be used in the bar chart (that match the m & m colors)
barplot(mm.counts,col=mm.colors)