# Cars1 Example # Plot the cars dataset with columns speed and dist. # Create nine plots, one for each possible value of type. # Send plots to PDF file. pdf("car-plots.pdf") # Create plots of various types, all in the same PDF file. for(t in c("p", "l", "b", "c", "o", "h", "s", "S", "n")) { subtitle <- paste("Plot type = \'", t, "\'", sep="") plot(cars, main="Cars Example", sub=subtitle, type=t, xlab="Speed of Car (mph)", ylab="Stopping Distance (ft)") } # Set plotting device back to default. dev.off()