C1 - Exercise Sheet

Here you find the exercise sheet for chapter 1: “Getting Started”

R as a calculator

Task 1

Use R to do the following calculations:

Task 2

Assign a variable x the value of 5 and a variable y the value of 3.

Task 3

Create the variable z as the product of x and y and in a next step check the value of z.

Task 4

Run the code line below:

# Run
w <- ((((25*(-13))/0.753))^2)*(-0.000466)

Use logical operators to check the following things:

Basic R programming

Task 5

Create a vector that contains the numbers 21, 28, 31, 23 and 45 and call this vector bmi.

Task 6

Create a vector that contains the words “subject_1”, “subject_2”, “subject_3”, “subject_4” and “subject_5” and call this vector names.

Task 7

Check the types of the bmi and names vector.

Task 8

Combine the two vectors names and bmi in a list and call this list bmi_data. Check out the content of this list by calling it.