jimmyday12 / fitzRoy

A set of functions to easily access AFL data
https://jimmyday12.github.io/fitzRoy
Other
129 stars 27 forks source link

2021 Brownlow votes AFL Tables #176

Closed SgtButane closed 2 years ago

SgtButane commented 2 years ago

Brownlow votes for the 2021 season not populating using get_afltables_stats

jimmyday12 commented 2 years ago

Thanks mate - will take a look this weekend

jimmyday12 commented 2 years ago

For reference later on, here is a reprex

df <- get_afltables_stats("2021-01-01", "2021-12-01")
any(is.na(df$Browlow.Votes))
# TRUE
jimmyday12 commented 2 years ago

Not that it fixes the problem but just adding here that the way to do this should now be via fetch_players_stats function. Most of the functions starting with get will be deprectated in the next major release.

fetch_player_stats_afltables(2021)
SgtButane commented 2 years ago

Not that it fixes the problem but just adding here that the way to do this should now be via fetch_players_stats function. Most of the functions starting with get will be deprectated in the next major release.

fetch_player_stats_afltables(2021)

Cheers.

Thanks for your hard work.

jimmyday12 commented 2 years ago

I think this should be fixed now

library(dplyr)
library(fitzRoy)
df <- fetch_player_stats_afltables(2021)

df %>%
  select(Season, Round, Date, Home.team, Away.team, First.name, Surname, Brownlow.Votes) %>%
  filter(Brownlow.Votes > 0)

#> # A tibble: 594 × 8
#>    Season Round Date       Home.team   Away.team        First.…¹ Surname Brown…²
#>     <dbl> <chr> <date>     <chr>       <chr>            <chr>    <chr>     <dbl>
#>  1   2021 1     2021-03-18 Richmond    Carlton          Jack     Graham        1
#>  2   2021 1     2021-03-18 Richmond    Carlton          Dustin   Martin        3
#>  3   2021 1     2021-03-18 Richmond    Carlton          Sam      Walsh         2
#>  4   2021 1     2021-03-19 Collingwood Western Bulldogs Marcus   Bontem…       2
#>  5   2021 1     2021-03-19 Collingwood Western Bulldogs Jack     Macrae        1
#>  6   2021 1     2021-03-19 Collingwood Western Bulldogs Bailey   Smith         3
#>  7   2021 1     2021-03-20 Melbourne   Fremantle        Steven   May           1
#>  8   2021 1     2021-03-20 Melbourne   Fremantle        Tom      McDona…       2
#>  9   2021 1     2021-03-20 Melbourne   Fremantle        Clayton  Oliver        3
#> 10   2021 1     2021-03-20 Adelaide    Geelong          Ben      Keays         1
#> # … with 584 more rows, and abbreviated variable names ¹​First.name,
#> #   ²​Brownlow.Votes