Using R/fitzRoy to ask: how many times a V/AFL team with the same lineup has played together?

If you sit in the intersection of “likes Australian Rules football / finds sport statistics interesting / is on Twitter”, you’ve probably come across Swamp. One of his recent tweets tells us that: No V/@AFL premiership winning lineup have all played together in another V/@AFL match, there has always been at least one person missingAll MELB 2021 premiership players are still at the club in 2022 @melbournefc— Swamp (@sirswampthing) March 16, 2022 You may go on to ask: has any team lineup from one of the almost 16 000 recorded games played together again in another game? And if so, how often? The answer to that question is at once surprising, less surprising when you think about it, and quite easy to figure out using the ever-helpful fitzRoy package. Getting the data Several options would work: I used the fitzRoy function get_fryzigg_stats() which although deprecated, does what I want (gets all games from 1897 onwards in one shot), and returns nicer variable names than some of the other functions. library(tidyverse) library(fitzRoy) library(lubridate) # get data afldata <- fitzRoy::get_fryzigg_stats() Most games played by the same lineup Players in a team are identified by a numerical player_id. So we can represent the team lineup (here called squad) by sorting the IDs and pasting them into a character string. Then, simply counting the strings and filtering for n > 1 will return teams where the same set of players played ...
Source: What You're Doing Is Rather Desperate - Category: Bioinformatics Authors: Tags: australia sport statistics afl fitzroy rstats Source Type: blogs