jimmyday12 / fitzRoy

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

Goal Assist column seems to be duplicating #135

Closed juzz88 closed 3 years ago

juzz88 commented 3 years ago

Apologies if you guys are already all over this, but I couldn't find anything in open issues.

I think because Goal Assists (GA) appear in both Basic and Advanced stats on FootyWire, it's creating a bunch of duplicate GA columns in player_stats_table in the get_match_data function:

        player_stats_table <- player_stats_advanced %>%
          dplyr::select(-dplyr::one_of(info_columns)) %>%
          dplyr::bind_cols(player_stats_basic) %>%
          dplyr::select(dplyr::one_of(info_columns), dplyr::everything())

I was able to fix it by removing the GA column from the advanced stats table, but I'm guessing you guys will want something more sophisticated than my crude solution below!

      if (is.list(footywire_advanced)) {
        player_stats_advanced <- footywire_html(footywire_advanced, id)
        player_stats_advanced = subset(player_stats_advanced, select = -c(GA) )

I'm guessing there's a way to search the player_stats_basic column names and remove any duplicates found in player_stats_advaced before the merge?

jimmyday12 commented 3 years ago

Hmmm thanks - I remember fixing this a while back in https://github.com/jimmyday12/fitzRoy/issues/59.

I'll take a look