date()
## [1] "Thu Oct 25 23:02:29 2012"
Due Date: October 26, 2012, 2pm
Total Points: 30; Each question is worth 10 points.
(1) The data frame trees provides measurements of the girth, height, and volume of timber in 31 felled black cherry trees. The variable Girth is the tree diameter in inches and the variable Height is the height in feet. Use the traditional graphics functions to create a scatter plot of Girth versus Height placing Girth on the horizontal axis. Label the axes including the measurement units.
with(trees, plot(Girth, Height, main = "Trees: Girth vs. Height", xlab = "Girth (in)",
ylab = "Height (ft)"))
(2) Using the same trees data frame, create a box plot of the Volume variable. Label the axis.
boxplot(trees$Volume, main = "Volume of Timber", ylab = "Volume")
(3) Repeat question (1) using functions from the ggplot2 package to create the scatter plot.
require(ggplot2)
## Loading required package: ggplot2
ggplot(trees, aes(x = Girth, y = Height)) + geom_point() + ggtitle("Trees: Girth vs. Height") +
xlab("Girth (in)") + ylab("Height (ft)")