These exercises require you to generate plots of various kinds. This document
shows both the plots that you should obtain.

Not everything was necessarily covered during the teaching session, you may need
to use R help pages, the Cheat Sheets, or search the web to figure out the 
answers.

## Part I -- geoms and aesthetics

These first few exercises will run through some of the simple principles of
creating a ggplot2 object, assigning aesthetics mappings and geoms.

1. Read in the cleaned patients dataset, `patient-data-cleaned.txt`, into a
   new object called `patients`.

```{r message = FALSE, warning = FALSE}

```

### Scatterplots

2. Generate a scatter plot of BMI versus Weight using the patient dataset .

```{r }

```

3. Extending the plot from exercise 2, add a colour scale to the scatterplot
   based on the Height variable.

```{r }

```

4. Using an additional geom, add an extra layer of a fit line to the solution
   from exercise 3.

```{r }

```

5. Does the fit in question 5 look good? Look at the help page for
   `geom_smooth` and adjust the method to fit a straight line without standard
   error bounds.

```{r }

```

### Boxplots and Violin plots

6. Generate a boxplot of BMIs comparing smokers and non-smokers.

```{r }

```

7. Following from the boxplot comparing smokers and non-smokers in exercise 6,
   colour boxplot edges by Sex.

```{r }

```

8. Produce a similar boxplot of BMIs but this time group data by Sex and colour
   the interior of the box (not the outline) by Age.

_Hint: is Age currently the right type of variable for grouping in a box plot?_

```{r }

```

9. Regenerate the solution to exercise 8 but this time using a violin plot.

```{r }

```

### Histogram and Density plots

10. Generate a histogram of BMIs with each bar coloured blue, choosing a
    suitable bin width.

```{r }

```

11. Instead of a histogram, generate a density plot of BMI

```{r }

```

12. Generate density plots of BMIs coloured by Sex.

_Hint: alpha can be used to control transparency._

```{r }

```

### Line plots - time series data

Time series data is often represented using line graphs. Here we will look at 
the data in the `diabetes.txt` file.

13. Read in the cleaned patients dataset, `diabetes.txt`, into a new object 
called `diabetes`. There are lots of patients in this study, let's just look at 
a few of them - subset the table to only keep patients with ID's **AC/AH/001**, 
**AC/AH/017**, and **AC/AH/020**.


```{r message = FALSE, warning = FALSE}

```

14. Create a line plot that allows us to examine the change in Glucose levels
for each patient by Date.

```{r }

```

15. Add points to the plot from 14 to make the measurement time-points clearer.
Instead of a dot change the *shape* to a hollow circle and colour the 
interior of the point.

```{r }

```

## Session Info

```{r}
sessionInfo()
```

