Tasks

Note: You need to install the packages nycflights13 and tidyverse in order to complete the exercises.

  1. Complete exercises 1 to 3 from section 5.2.4 in R for Data Science. For exercise 1, choose only 3 out of the 7 tasks (you can choose any task you want).
  2. Complete exercises 1 to 3 from section 5.3.1 in R for Data Science
  3. Complete exercises 1 and 2 from section 5.4.1 in R for Data Science
  4. Download and unzip 05transform1-resources.zip from the course website, read codebook.txt and complete the following tasks:
    1. Load the CSV file schulen_potsdam.csv into R without specifying further parameters for read.csv(). Have a look at the data using functions like str() and head(). Do you spot any potential problems?
    2. Load the data again, this time specifying two additional parameters for read.csv(): stringsAsFactors = FALSE, colClasses = c(plz = "character"). Inspect the result. What is the effect of these parameters? Are all problems now fixed and do the variable types match the specifications in the codebook (see codebook.txt also contained in the zip-file)? If not, convert these variables to the correct data type using mutate() and as.factor().
    3. Create a new variable full_address using mutate(). This new variable should contain the full address consisting of street name, zip code and city name, e.g. “Carl-von-Ossietzky-Straße 37 01570 Potsdam”. You can combine several strings to form one string using the function paste().
  5. Optional: Complete exercises 1 and 2 from section 5.5.2 in R for Data Science