JaseZiv / worldfootballR

A wrapper for extracting world football (soccer) data from FBref, Transfermark, Understat
https://jaseziv.github.io/worldfootballR/
455 stars 60 forks source link

Error with `fb_match_shooting()` #217

Closed mrmorgan17 closed 1 year ago

mrmorgan17 commented 1 year ago

When I was testing out the fb_match_shooting function, I ran into the following error:

shot_one_match <- fb_match_shooting(match_url = "https://fbref.com/en/matches/47880eb7/Liverpool-Manchester-City-November-10-2019-Premier-League")
Error in `dplyr::mutate()`:
! Can't transform a data frame with duplicate
  names.
Run `rlang::last_error()` to see where the error occurred.

rlang::last_error() returned this:

<error/rlang_error>
Error in `dplyr::mutate()`:
! Can't transform a data frame with duplicate
  names.
---
Backtrace:
 1. worldfootballR::fb_match_shooting(match_url = "https://fbref.com/en/matches/47880eb7/Liverpool-Manchester-City-November-10-2019-Premier-League")
 9. dplyr:::mutate.data.frame(...)
Run `rlang::last_trace()` to see the full context.

rlang::last_trace() returned this:

<error/rlang_error>
Error in `dplyr::mutate()`:
! Can't transform a data frame with duplicate
  names.
---
Backtrace:
     ▆
  1. ├─worldfootballR::fb_match_shooting(match_url = "https://fbref.com/en/matches/47880eb7/Liverpool-Manchester-City-November-10-2019-Premier-League")
  2. │ └─match_url %>% purrr::map_df(get_each_match_shooting_data)
  3. ├─purrr::map_df(., get_each_match_shooting_data)
  4. │ └─purrr::map(.x, .f, ...)
  5. │   └─worldfootballR (local) .f(.x[[i]], ...)
  6. │     └─worldfootballR (local) prep_shot_df(home_shot_df)
  7. │       └─shot_df %>% ...
  8. ├─dplyr::mutate(...)
  9. └─dplyr:::mutate.data.frame(...)
 10.   └─dplyr:::mutate_cols(.data, dplyr_quosures(...), caller_env = caller_env())
 11.     └─DataMask$new(.data, caller_env, "mutate", error_call = error_call)
 12.       └─dplyr (local) initialize(...)
 13.         └─rlang::abort(...)
JaseZiv commented 1 year ago

Can you confirm what version you're using? I think this issue was fixed with a recent push to the dev version.

Using version 0.6.1.6000, I couldn't recreate this error you're getting.

mrmorgan17 commented 1 year ago

I was using version 0.6.1. Ill get the dev version and see if that fixes it for me as well

mrmorgan17 commented 1 year ago

I just installed version 0.6.1.6000 using devtools::install_github("JaseZiv/worldfootballR") and re-ran

shot_one_match <- fb_match_shooting(match_url = "https://fbref.com/en/matches/47880eb7/Liverpool-Manchester-City-November-10-2019-Premier-League")

And the error persists

Error in `dplyr::mutate()`:
! Can't transform a data frame with duplicate
  names.
Run `rlang::last_error()` to see where the error occurred.

I'm using version 1.0.10 of dplyr and R version 4.2.2

JaseZiv commented 1 year ago

Did you restart your session?

mrmorgan17 commented 1 year ago

That's what I was forgetting. fb_match_shooting() works now for version 0.6.1.6000