The Data

AFLTables.com provides historic data on every VFL/AFL game ever played, all the way back to the leagues inception in 1897.

The web-link can be found here: https://afltables.com/afl/stats/biglists/bg3.txt.

In this rpub, I will visualise change in average match-day scores from 1897 to the present. The approach herein will hopefuly encourage further analyses

First, lets load-in our dependencies :

Read URL to R, specifying columns and delimiters

We should now have a dataframe with 8 variables, and 15,407 rows

ID Date Round HomeTeam HomeScore AwayTeam AwayScore Venue
1 8-May-1897 R1 Fitzroy 6.13.49 Carlton 2.4.16 Brunswick St
2 8-May-1897 R1 Collingwood 5.11.41 St Kilda 2.4.16 Victoria Park
3 8-May-1897 R1 Geelong 3.6.24 Essendon 7.5.47 Corio Oval
4 8-May-1897 R1 South Melbourne 3.9.27 Melbourne 6.8.44 Lake Oval
5 15-May-1897 R2 South Melbourne 6.4.40 Carlton 5.6.36 Lake Oval
6 15-May-1897 R2 Essendon 4.6.30 Collingwood 8.2.50 East Melbourne

Cleaning and Feature Extraction

Change variable types

Extract out ‘Year’ from our date column

Separate ‘score’ column(s) into goals, behinds and total

Change score variables from character to numeric

##          ID        Date       Round    HomeTeam   HomeGoals HomeBehinds 
##   "numeric" "character"    "factor" "character" "character" "character" 
##   HomeTotal    AwayTeam   AwayGoals AwayBehinds   AwayTotal       Venue 
## "character" "character" "character" "character" "character"    "factor" 
##         Day       Month        Year 
##   "numeric" "character"   "numeric"
##          ID        Date       Round    HomeTeam   HomeGoals HomeBehinds 
##   "numeric" "character"    "factor" "character"   "numeric"   "numeric" 
##   HomeTotal    AwayTeam   AwayGoals AwayBehinds   AwayTotal       Venue 
##   "numeric" "character"   "numeric"   "numeric"   "numeric"    "factor" 
##         Day       Month        Year 
##   "numeric" "character"   "numeric"

Aggregate teams who have merged

Finally, create an ‘era’ variable which breaks down games by the decade they occurred in. We will use this variable as a slicer for the visualisation

Aggregation

Let’s begin building a table summarising the total number of games and total score of each team, per decade

Combine home and away scores and games to get absolute totals. Determine the average score per team, per game, per decade

View our newly developed table

Era Team GamesHome GamesAway TotalGames AwayTotal HomeTotal TotalScore AverageScore
1890s Carlton 22 26 48 632 578 1210 25.21
1890s Collingwood 26 26 52 1087 1126 2213 42.56
1890s Essendon 27 25 52 979 1529 2508 48.23
1890s Fitzroy/Brisbane 28 23 51 903 1187 2090 40.98
1890s Geelong 27 24 51 1083 1534 2617 51.31
1890s Melbourne 22 29 51 960 1058 2018 39.57

Visualising the data

Create a minimalistic theme for our animated plot

Visualise the average score per match, per team, across each decade

This interactive visualisation clearly shows that with each passing decade up until the 1980s, incremental increases in average score per team, per game can be observed. Scoring has increased nearly three-fold since the 1890s. From 1990 to the present, there has been a slight downward trend in overall scoring. This is probably attributable to more sophisticated defensive tactics as the game has matured into a professional competition.