Still here. Still writing occasional posts for a tiny audience.

[This article was first published on R – What You're Doing Is Rather Desperate, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

It’s been a while because, reasons.

I’m still alive, still enjoying recreational R programming and still writing the occasional post that almost no one reads these days. Like this one.

Sam Lord writes on the site formerly known as Twitter:

I bet that we can answer that using R/fitzRoy. Here’s one attempt.

library(dplyr)
library(fitzRoy)

afldata_processed <- afldata %>% 
  # only Grand Finals and only those with jumper numbers
  filter(Round == "GF", 
         Jumper.No. != "") %>% 
  # calculate score margin 
  mutate(Margin = case_when(Playing.for == Home.team ~ Home.score - Away.score, 
                            Playing.for == Away.team ~ Away.score - Home.score) %>%
  # only winners!
  filter(Margin > 0) %>% 
  # players with > 1 jumper number but played one team
  group_by(First.name, Surname, ID) %>% 
  filter(n_distinct(Jumper.No.) > 1, 
         n_distinct(Playing.for) == 1)  %>% 
  ungroup() %>% 
  distinct(Season, ID, First.name, Surname, Playing.for, Jumper.No., Margin) %>% 
  arrange(ID, First.name, Surname) %>% 
  # label Seasons with same ID if consecutive 
  group_by(ID) %>% 
  mutate(conseq = cumsum(c(1, diff(Season) != 1))) %>% 
  group_by(ID, conseq) %>% 
  # find players who played 2 or more consecutive seasons with different jumper numbers 
  filter(n() > 1, 
         n_distinct(Jumper.No.) > 1) %>% 
  ungroup()

A rare feat? Well, there are…

afldata_processed %>% 
  distinct(ID) %>%
  nrow()

# [1] 56

…56 players, of 2 480 to have ever played in a V/AFL Grand Final. So yes, somewhat rare.

In the AFL era (defined here as 1990 onwards), there are just…

afldata_processed %>%
  filter(Season > 1989) %>%
  select(-conseq)

# A tibble: 4 × 7
  Season    ID First.name Surname  Playing.for    Jumper.No. Margin
   <int> <int> <chr>      <chr>    <chr>               <dbl>  <int>
1   2019 12661 Liam       Baker    Richmond               48     89
2   2020 12661 Liam       Baker    Richmond                7     31
3   2024 13072 Jaspa      Fletcher Brisbane Lions         28     60
4   2025 13072 Jaspa      Fletcher Brisbane Lions          3     47

…two players to have played in winning consecutive Grand Finals wearing different numbers. You can add Hawthorn’s Andrew Collins (1988-1989) to the list if you want to define the “modern era” as post-1981. All in agreement with the replies to Sam’s post, well done everyone.

Looking more closely at the data, we see that most of the games played in different jumpers were VFL games in the 1920s and 1930s, particularly involving Collingwood. Changing numbers (in all games) seems to have been much more common in the past than it is now.

library(ggplot2)

afldata_processed %>%
  count(Season, Playing.for) %>%
  ggplot(aes(Season, n)) +
    geom_col() +
    facet_wrap(~Playing.for) +
    labs(y = "Count",
         title = "Count of players with different numbers in consecutive \
         winning V/AFL Grand Finals",
         subtitle = "by team and season") +
theme_bw()
To leave a comment for the author, please follow the link and comment on their blog: R – What You're Doing Is Rather Desperate.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)