November 2016
Beginner to intermediate
959 pages
43h 46m
English
We often want to see plots side by side for comparisons. This recipe shows how we can achieve this.
If you have not already done so, download the data files for this chapter and ensure that they are available in your R environment's working directory. Once this is done, run the following commands:
> auto <- read.csv("auto-mpg.csv")
> cylinders <- factor(cylinders, levels = c(3,4,5,6,8), labels = c("3cyl", "4cyl", "5cyl", "6cyl", "8cyl"))
> attach(auto)You may want to generate two side-by-side scatterplots from the data in auto-mpg.csv. Run the following commands:
> # first get old graphical parameter settings > old.par = par() > # create a grid of one row and two columns > par(mfrow ...
Read now
Unlock full access