###Boxplot
#Let's visualize the amount of Christmas magic by each tree type.
#Here ~ means "by". We're telling R which are the X and the Y axes.
#This tilde/squiggle is going to be very important for almost every R package
#We are going to get a summary of the distribution of magic by tree type
boxplot(xmas.magic~type, data=tree.dat)
#Let's create subsets of each of our tree types.
pines <-subset(tree.dat, type=="pine")
firs <-subset(tree.dat, type=="fir")
spruces <-subset(tree.dat, type=="spruce")
#Now let's just compare the height of pines vs. spruces.
boxplot(pines$height, spruces$height)
#And because it's Christmas, let's add a little Christmas cheer:
boxplot(pines$height, spruces$height, col=c("red", "forestgreen"),
names=c("Pines", "Spruces"), ylab="Tree Height")
#In addition, in the code above, notice the extra subcommand ylab
#This assigns a meaningful label to the Y axis