5  Lab Exercise 3

In this exercise, you’re going to work on different kinds of plots using ggplot2. Create a (commented) script in R to document your code. Your datasets will be:

The iris dataset

The mtcars dataset

Each of these contains combinations of categorical and numerical variables. Descriptions of these datasets can be found using the ? to access R help. Using data in these datasets, create a barplot from one of these, and a histogram from the other, using the appropriate dataset.

Finally, using the gapminder dataset (from the gapminder package), create a subset of data from European nations, then plot GDP and life expectancy, coloring the points by year. (HINT: Try to think about why color is represented the way it is in this graph, and how you might change it).

Once you’re done, submit the script and all 3 plots to the Canvas assignment page.