Session Ready
Exercise

Using multiple plots to give multiple views of a dataset

As noted in the video, another useful application of multiple plot arrays besides comparison is presenting multiple related views of the same dataset.

This exercise illustrates this idea, giving four views of the same dataset: a plot of the raw data values themselves, a histogram of these data values, a density plot, and a normal QQ-plot.

Instructions
100 XP
  • Note that the MASS and car packages have been pre-loaded, making the geyser data and the truehist() and qqPlot() functions available for your use.
  • Use the par() function to set the mfrow parameter for a two-by-two plot array.
  • In the upper left, use the plot() function to show the values of the duration variable from the geyser dataset, using the main argument to specify the plot title as "Raw data".
  • In the upper right, use the truehist() function to generate a histogram of the duration data, using the main argument to give this plot the title "Histogram".
  • In the lower left, use the plot() and density() functions to display the density of the duration values, using the main argument to give this plot the title "Density".
  • In the lower right, use the qqPlot() function from the car package to display a normal QQ-plot of the duration data, using the main argument to give this plot the title "QQ-plot".