Base-R and ggplot2 Graphics introduces R's two plotting systems. Draw the same picture in both.

The program reads the name of a column of mtcars, such as mpg.

  1. With base R, draw a scatterplot of that column against wt using plot(), with axis labels.
  2. With ggplot2, draw the same scatterplot using geom_point(), and print() it.
  3. Print the correlation between wt and the column, rounded to 3 decimal places, as Correlation: …

For mpg the output is Correlation: -0.868.

Compare the two pictures. What does ggplot2 give you without asking, and what took more typing?

Run draws your plot under the output. Check and Submit test the numbers your program prints.

You do not have permission to attempt this activity.