C2 - Exercise Sheet

Here you find the exercise sheet for chapter 2: “Data Analysis Basics”

Start a project and import data

Task 1

Create an R project for solving this Exercise Sheet.

Task 2

Download the csv-file SSRC_data.csv and the R script SSRC_C2_template.R and put it in the R project folder you created in Task 1.

Task 3

Open the SSRC_C2_template.R R Script.

Task 4

Use the read.csv() command to load the SSRC data into R and call the respective data object SSRC_data.

Task 5

Get a first impression of the dataset by checking out the first 6 rows of the dataset and by looking at the data in the spreadsheet mode.

Task 6

Install and load the tidyverse package. (If you have already installed the package before, loading the package is sufficient)

Isolating data

Task 7

Create a dataset that only contains the variables age and bmi and call this dataset SSRC_data_C2_task_7. Check out the first six rows of this dataset.

Task 8

Create a dataset that only contains subjects with a bmi below 18.5 and call this dataset SSRC_data_C2_task_8. Check out the first six rows of this dataset.

Task 9

Create a dataset that only contains individuals that have a low level of education and a bmi above 25 and call this dataset SSRC_data_C2_task_9. Check out the first six rows of this dataset.

Task 10

Create a dataset that only contains individuals with a bmi between 18.5 and 25 and is restricted to the variables bmi and gender. Use the Pipe operator to do so and call the dataset SSRC_data_C2_task_10. Check out the first six rows of this dataset.

Deriving information

Task 11

Use the summarize() command in combination with the filter() command to calculate the mean, maximum and minimum bmi of males that feature a low level of physical activity.

Task 12

Use the summarize() command in combination with the group_by() command to compare males and females with respect to their mean age and bmi.