Assignment 4

Preparation

Download this Rmarkdown file, fill in your name and student number, and complete your assignment in the Rmarkdown file. “knit” your text and code into a pdf-file, and upload this pdf-file on Brightspace before the next lecture. Make sure that your pdf-output looks correct.

Visualization

This is a historical dataset on the modern Olympic Games, including all the Games from Athens 1896 to Rio 2016. The data was retrieved from here.

Packages & Data

library(ggplot2)
library(tidyverse) # install.packages("tidyverse") if you haven't done so
data  <- read.csv("https://stulp.gmw.rug.nl/dataviz/athlete_events.csv", 
                  header = TRUE)
head(data)
##   ID                     Name Sex Age Height Weight           Team NOC
## 1  1                A Dijiang   M  24    180     80          China CHN
## 2  2                 A Lamusi   M  23    170     60          China CHN
## 3  3      Gunnar Nielsen Aaby   M  24     NA     NA        Denmark DEN
## 4  4     Edgar Lindenau Aabye   M  34     NA     NA Denmark/Sweden DEN
## 5  5 Christine Jacoba Aaftink   F  21    185     82    Netherlands NED
## 6  5 Christine Jacoba Aaftink   F  21    185     82    Netherlands NED
##         Games Year Season      City         Sport
## 1 1992 Summer 1992 Summer Barcelona    Basketball
## 2 2012 Summer 2012 Summer    London          Judo
## 3 1920 Summer 1920 Summer Antwerpen      Football
## 4 1900 Summer 1900 Summer     Paris    Tug-Of-War
## 5 1988 Winter 1988 Winter   Calgary Speed Skating
## 6 1988 Winter 1988 Winter   Calgary Speed Skating
##                                Event Medal
## 1        Basketball Men's Basketball  <NA>
## 2       Judo Men's Extra-Lightweight  <NA>
## 3            Football Men's Football  <NA>
## 4        Tug-Of-War Men's Tug-Of-War  Gold
## 5   Speed Skating Women's 500 metres  <NA>
## 6 Speed Skating Women's 1,000 metres  <NA>

Your task

On the basis of data from the Olympic Games, try to create an informative and pretty graph. Include the following elements.

  • Visualize the relationship between height and weight for both men and women.

  • Multiple layers are encouraged.

  • You can make use of the full dataset or you can make a selection (e.g., focussing on only one year/country/sport).

  • Explain in no more than 250 words what the graph is showing, and what unique insights it delivers. Also reflect on what it fails to show or what you would have liked to include in the graph but was not able to.

  • Create appropriate axis-labels and titles. Appropriate breaks/limits/labels are encouraged.

  • Create your own theme and add this theme to your graph.

  • Try to use different colours than the ggplot-standards.

  • Be sure to create clean code (see here)

Submit your PDF-file online

When you are done with your assignment, try clicking the “Knit”-button in Rstudio so that your code will be knitted into a pdf-file. Submit this file on Brightspace.

If you see an error appear, try to fix the error and try again. If you can’t get the “knitting” to work, then you can copy your code, text, and graphs into a word-file and submit it on Brightspace.