Exercise 1
Try Exercise 1 yourself!
Now it’s your turn.
Tasks
See the solution to the following task on the next page.
Task: Data about height and weight
Create three vectors named height, weight and state. For this exercise, interpret the heights in metres and the weights in kilograms; state contains German federal-state labels.
height(m): 1.67, 1.8, 1.58, 1.83, 1.65, 1.74, 1.8, 1.6, 1.76, 1.8weight(kg): 62, 78, 56, 85, 58, 70, 70, 120, 62, 90state: NRW, Bayern, Sachsen, Hessen, Hessen, MV, Hessen, Brandenburg, Hessen, Berlin
Each vector has ten entries. Entries in the same position belong to the same person, so keep the given order. Print each vector to inspect its contents.
Hint
Use the lowercase object names given above. Combine values with c(...). Write heights and weights as numbers, using a decimal point where needed, and put each state label in quotation marks.