The following are the activity solutions for this chapter.
Chapter 2: Data Visualization and Graphics
Activity: Recreating Plots with Base Plot Methods
The following code can be used to load the datasets library:
library(datasets)
install.packages("ggplot2")
library(ggplot2)
The following code can be used to load the data:
data("iris")
data("mpg")
The following code can be used to create a scatterplot to plot petal width without an axis label:
plot(iris$Petal.Width)
The following code can be used to create a scatterplot to plot petal width without axis labels:
plot(iris$Petal.Width, iris$Petal.Length,
main = "Petal Length vs. Petal Width",
xlab = "Petal Width",
ylab...