get_afltables_stats returns a data frame containing match stats for each game within the specified date range

get_afltables_stats(start_date = "1897-01-01", end_date = Sys.Date())

Arguments

start_date

character string for start date return to URLs from, in "dmy" or "ymd" format

end_date

optional, character string for end date to return URLS, in "dmy" or "ymd" format

Value

a data table containing player stats for each game between start date and end date

Details

This function returns a data frame containing match stats for each game within the specified date range. The data from contains all stats on afltables match pages and returns 1 row per player.

The data for this function is hosted on github to avoid extensive scraping of historical data from afltables.com. This will be updated regularly.

Examples

#
# Gets all data get_afltables_stats()
#> Returning data from 1897-01-01 to 2019-10-16
#> Downloading data
#> #> Finished downloading data. Processing XMLs
#> Finished getting afltables data
#> # A tibble: 629,496 x 59 #> Season Round Date Local.start.time Venue Attendance Home.team HQ1G #> <dbl> <chr> <date> <int> <chr> <int> <chr> <int> #> 1 1897 1 1897-05-08 1500 Brun… 3000 Fitzroy 0 #> 2 1897 1 1897-05-08 1500 Brun… 3000 Fitzroy 0 #> 3 1897 1 1897-05-08 1500 Brun… 3000 Fitzroy 0 #> 4 1897 1 1897-05-08 1500 Brun… 3000 Fitzroy 0 #> 5 1897 1 1897-05-08 1500 Brun… 3000 Fitzroy 0 #> 6 1897 1 1897-05-08 1500 Brun… 3000 Fitzroy 0 #> 7 1897 1 1897-05-08 1500 Brun… 3000 Fitzroy 0 #> 8 1897 1 1897-05-08 1500 Brun… 3000 Fitzroy 0 #> 9 1897 1 1897-05-08 1500 Brun… 3000 Fitzroy 0 #> 10 1897 1 1897-05-08 1500 Brun… 3000 Fitzroy 0 #> # … with 629,486 more rows, and 51 more variables: HQ1B <int>, HQ2G <int>, #> # HQ2B <int>, HQ3G <int>, HQ3B <int>, HQ4G <int>, HQ4B <int>, #> # Home.score <int>, Away.team <chr>, AQ1G <int>, AQ1B <int>, AQ2G <int>, #> # AQ2B <int>, AQ3G <int>, AQ3B <int>, AQ4G <int>, AQ4B <int>, #> # Away.score <int>, First.name <chr>, Surname <chr>, ID <dbl>, #> # Jumper.No. <dbl>, Playing.for <chr>, Kicks <dbl>, Marks <dbl>, #> # Handballs <dbl>, Goals <dbl>, Behinds <dbl>, Hit.Outs <dbl>, Tackles <dbl>, #> # Rebounds <dbl>, Inside.50s <dbl>, Clearances <dbl>, Clangers <dbl>, #> # Frees.For <dbl>, Frees.Against <dbl>, Brownlow.Votes <dbl>, #> # Contested.Possessions <dbl>, Uncontested.Possessions <dbl>, #> # Contested.Marks <dbl>, Marks.Inside.50 <dbl>, One.Percenters <dbl>, #> # Bounces <dbl>, Goal.Assists <dbl>, Time.on.Ground.. <int>, #> # Substitute <int>, Umpire.1 <chr>, Umpire.2 <chr>, Umpire.3 <chr>, #> # Umpire.4 <chr>, group_id <int>
# Specify a date range get_afltables_stats("01/01/2018", end_date = "01/04/2018")
#> Returning data from 2018-01-01 to 2018-04-01
#> Finished getting afltables data
#> # A tibble: 660 x 59 #> Season Round Date Local.start.time Venue Attendance Home.team HQ1G #> <dbl> <chr> <date> <int> <chr> <int> <chr> <int> #> 1 2018 1 2018-03-22 1925 "M.C… 90151 Richmond 4 #> 2 2018 1 2018-03-22 1925 "M.C… 90151 Richmond 4 #> 3 2018 1 2018-03-22 1925 "M.C… 90151 Richmond 4 #> 4 2018 1 2018-03-22 1925 "M.C… 90151 Richmond 4 #> 5 2018 1 2018-03-22 1925 "M.C… 90151 Richmond 4 #> 6 2018 1 2018-03-22 1925 "M.C… 90151 Richmond 4 #> 7 2018 1 2018-03-22 1925 "M.C… 90151 Richmond 4 #> 8 2018 1 2018-03-22 1925 "M.C… 90151 Richmond 4 #> 9 2018 1 2018-03-22 1925 "M.C… 90151 Richmond 4 #> 10 2018 1 2018-03-22 1925 "M.C… 90151 Richmond 4 #> # … with 650 more rows, and 51 more variables: HQ1B <int>, HQ2G <int>, #> # HQ2B <int>, HQ3G <int>, HQ3B <int>, HQ4G <int>, HQ4B <int>, #> # Home.score <int>, Away.team <chr>, AQ1G <int>, AQ1B <int>, AQ2G <int>, #> # AQ2B <int>, AQ3G <int>, AQ3B <int>, AQ4G <int>, AQ4B <int>, #> # Away.score <int>, First.name <chr>, Surname <chr>, ID <dbl>, #> # Jumper.No. <dbl>, Playing.for <chr>, Kicks <dbl>, Marks <dbl>, #> # Handballs <dbl>, Goals <dbl>, Behinds <dbl>, Hit.Outs <dbl>, Tackles <dbl>, #> # Rebounds <dbl>, Inside.50s <dbl>, Clearances <dbl>, Clangers <dbl>, #> # Frees.For <dbl>, Frees.Against <dbl>, Brownlow.Votes <dbl>, #> # Contested.Possessions <dbl>, Uncontested.Possessions <dbl>, #> # Contested.Marks <dbl>, Marks.Inside.50 <dbl>, One.Percenters <dbl>, #> # Bounces <dbl>, Goal.Assists <dbl>, Time.on.Ground.. <int>, #> # Substitute <int>, Umpire.1 <chr>, Umpire.2 <chr>, Umpire.3 <chr>, #> # Umpire.4 <chr>, group_id <int>