Exercises


The following packages are required for this practical:

library(dplyr)
library(magrittr)
library(mice)
library(ggplot2)

and if you’d like the same results as I have obtained, you can fix the random seed

set.seed(123)

  1. Create a scatterplot between age and bmi in the mice::boys data set

  1. Now recreate the plot with the following specifications:

  1. Create a histogram for age in the boys data set

  1. Create a bar chart for reg in the boys data set With a standard plotting device in R:

  1. Create a box plot for hgt with different boxes for reg in the boys data set With a standard plotting device in R:

  1. Create a density plot for age with different curves for boys from the city and boys from rural areas (!city).

  1. Create a diverging bar chart for hgt in the boys data set, that displays for every age year that year’s mean height in deviations from the overall average hgt

End of Practical


Useful References

The ggplot2 reference webpage