Worksheet 2

Published

September 21, 2026

Questions are below. My solutions will be available after the tutorials are all finished. The whole point of these worksheets is for you to use your lecture notes to figure out what to do. In tutorial, the TAs are available to guide you if you get stuck. Once you have figured out how to do this worksheet, you will be prepared to tackle the assignment that depends on it.

There is probably too much here for you to finish in an hour, but I encourage you to continue later with what you were unable to finish in tutorial.

Packages

library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr     1.2.1     ✔ readr     2.2.0
✔ forcats   1.0.1     ✔ stringr   1.6.0
✔ ggplot2   4.0.3     ✔ tibble    3.3.1
✔ lubridate 1.9.5     ✔ tidyr     1.3.2
✔ purrr     1.2.2     
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag()    masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors

The Boat Race

Each year, the Oxford and Cambridge University rowing teams race against each other on the River Thames in London (England). For the 1992 race, the weights (in pounds) of the participants on each team were recorded, and can be found in https://ritsokiguess.site/datafiles/boat_race.txt.

  1. Take a look at the data file, and describe how the data values are separated one from the next.
  1. Read the file into a dataframe and display at least some of it.
  1. Make a suitable graph of your data.
  1. Would you say, based on your plot, that the average or typical weights of the rowers on the two teams are similar or different? Explain briefly.
  1. Each rowing team consists of eight rowers plus a cox, whose job is to keep the rowers in tempo. The cox does not row themselves. Which of the nine individuals in each team do you think is the cox? Explain briefly.

Diet Wars 1

312 subjects took part in a comparative study of three diets: a low-fat diet (labelled 1 in the dataset), a Mediterranean diet (labelled 2), and a low-carbohydrate diet (labelled 3). Each subject was randomly allocated to one of the diets. One measure of success of a diet program is (of course) how much weight a subject lost, but another is whether they stayed with their diet until the end of the study (1 in the Status column) or whether they dropped out of the study (0 in the Status column). The data are in http://datafiles.ritsokiguess.site/diet-wars-1.txt, one row per subject.

  1. Take a look at the data file (in your web browser). How is it laid out? How, therefore, will you read it in to a dataframe?
  1. Read in and display (a little of) the data.
  1. Make a suitable graph of these data. Hint 1: are those numbers in your dataset meaningful as numbers? If not, what kind of variables are they? Hint 2: to make a variable categorical even though it looks like a number, put it inside factor, ie. use something like factor(x) in your graph
  1. Interpret your graph, bearing in mind what we want to compare. If you wish, comment on something that made your graph difficult to interpret.

Hummingbirds and flowers

The tropical flower Heliconia is fertilized by hummingbirds, a different species for each variety of Heliconia. Over time, the lengths of the flowers and the form of the hummingbirds’ beaks have evolved to match each other. The length of the Heliconia flower is therefore an important measurement. Does it differ among varieties?

The data set at http://ritsokiguess.site/datafiles/heliconia_long.csv contains the lengths (in millimetres) of samples of flowers from each of three varieties of Heliconia: bihai, caribaea red, and caribaea yellow.

  1. Read in and display (some of) the dataset.
  1. Why would a boxplot be a suitable graph for these data? Explain briefly.
  1. Draw a boxplot1 of these data.
  1. What do you learn from your boxplot? Explain briefly.
  1. An alternative graph in this situation is a set of three histograms next to each other. Draw this graph. Consider your aims in drawing the graph; you will need to think about what “next to each other” most usefully means for you. Hint: problem 7.9(c) in PASIAS.

Footnotes

  1. It’s up to you whether you call this one boxplot, or one graph containing three side-by-side boxplots. Think about what makes more sense to you, and what will make more sense to your reader.↩︎