Setup
path <- "London Theatre Rankings 2024_May 23, 2024_13.00.csv"
raw <- as_tibble(readr::read_csv(path, skip = 1)) %>% rename("- not_seen" = "Indicate which plays you have not seen")
names(raw) <- str_extract(names(raw), '(?<=-\\s).*')
raw <- raw[-1,]
tidy <- raw %>% select("Operation Mincemeat":"not_seen")
titles <- raw %>% select("Operation Mincemeat":"Cabaret") %>% colnames()
for (col in 2:ncol(tidy)-1) {
for (row in 1:nrow(tidy)) {
if (grepl(titles[col], tidy[row, ncol(tidy)])) {
tidy[row, col] = NA
}
}
}
tidy_no_not_seen <- tidy %>% select(1:ncol(tidy)-1) %>% mutate_if(is.character, as.numeric)
tidy_longer <- tidy_no_not_seen %>% pivot_longer(cols = colnames(tidy_no_not_seen), names_to = "play", values_to = "rank")
Some Weird Stuff Going On
Enemy of the People
## # A tibble: 18 × 4
## # Groups: play [1]
## play rank means medians
## <chr> <dbl> <dbl> <dbl>
## 1 An Enemy of the People 2 9.06 8
## 2 An Enemy of the People 3 9.06 8
## 3 An Enemy of the People 3 9.06 8
## 4 An Enemy of the People 4 9.06 8
## 5 An Enemy of the People 5 9.06 8
## 6 An Enemy of the People 7 9.06 8
## 7 An Enemy of the People 7 9.06 8
## 8 An Enemy of the People 8 9.06 8
## 9 An Enemy of the People 8 9.06 8
## 10 An Enemy of the People 8 9.06 8
## 11 An Enemy of the People 10 9.06 8
## 12 An Enemy of the People 10 9.06 8
## 13 An Enemy of the People 12 9.06 8
## 14 An Enemy of the People 13 9.06 8
## 15 An Enemy of the People 14 9.06 8
## 16 An Enemy of the People 15 9.06 8
## 17 An Enemy of the People 17 9.06 8
## 18 An Enemy of the People 17 9.06 8

King Lear
## # A tibble: 18 × 4
## # Groups: play [1]
## play rank means medians
## <chr> <dbl> <dbl> <dbl>
## 1 King Lear 5 12.1 13.5
## 2 King Lear 5 12.1 13.5
## 3 King Lear 5 12.1 13.5
## 4 King Lear 7 12.1 13.5
## 5 King Lear 7 12.1 13.5
## 6 King Lear 9 12.1 13.5
## 7 King Lear 9 12.1 13.5
## 8 King Lear 12 12.1 13.5
## 9 King Lear 13 12.1 13.5
## 10 King Lear 14 12.1 13.5
## 11 King Lear 15 12.1 13.5
## 12 King Lear 15 12.1 13.5
## 13 King Lear 16 12.1 13.5
## 14 King Lear 16 12.1 13.5
## 15 King Lear 16 12.1 13.5
## 16 King Lear 17 12.1 13.5
## 17 King Lear 18 12.1 13.5
## 18 King Lear 18 12.1 13.5
