Exercises Graphics in R

Albart Coster

Basic graphics

Plotting:

  1. Load the nlme package and the make dataset Soybean available (code require(nlme); data(Soybean)). Explore this Soybean dataset.
  2. Plot the relationship between weight and Time.
  3. Explore the relationships between weight and Variety; weight and year.
  4. In one plot, display the relationship between weight and Time for each Variety. Add a legend to this plot.
  5. Save the plot as a pdf-file. Control if the plot has been saved on the approprate place.

Customizing a plot:

  1. Plot weight against Time of the Soybean dataset.
  2. Add a linear regression line for each Variety, use a different color for each Variety.
  3. Add a legend.
  4. Save the plot as a jpeg-file and check the file.

End exercises basic graphics

Plotting with ggplot2

  1. Make the dataset Soybean from package nlme available (code require(nlme); data(Soybean)).
  2. Plot weight against Time, with a different color and character per variety.
  3. Let year define the panels of the plot.
  4. Add trendlines to the plot

End exercises ggplot2 graphics