JaseZiv/worldfootballR

fb_league_stats() not returning data for `opponent`

Closed this issue · 0 comments

It appears as though fb_league_stats() is only returning stats for the team and isn't returning data for opponent.

data <- fb_league_stats(
  country = c("POR"),
  gender = "M",
  season_end_year = 2024,
  stat_type = "shooting",
  team_or_player = "team")
image

Digging in to the source code, it appears as though we're expecting it to return both @tonyelhabr?

purrr::map_dfr(
      seq_along(n_tables),
      ~{
        tables[[.x]] %>%
          .rename_fb_cols() %>%
          dplyr::mutate(
            "Team_or_Opponent" = ifelse(.x == 1, "team", "opponent"),
            .before = 1
          )
      }
    )
library(worldfootballR)
packageVersion("worldfootballR")

sessionInfo()

packageVersion("worldfootballR")
[1] ‘0.6.5’

sessionInfo()
R version 4.2.0 (2022-04-22)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS 13.6.3
Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] xml2_1.3.3 rvest_1.0.2 worldfootballR_0.6.5 lubridate_1.9.2
[5] janitor_2.1.0 forcats_0.5.1 stringr_1.5.1 dplyr_1.1.3
[9] purrr_1.0.2 readr_2.1.2 tidyr_1.3.0 tibble_3.2.1
[13] ggplot2_3.4.0 tidyverse_1.3.1 here_1.0.1
loaded via a namespace (and not attached):
[1] Rcpp_1.0.11 ps_1.7.0 prettyunits_1.1.1 rprojroot_2.0.3 utf8_1.2.3
[6] R6_2.5.1 cellranger_1.1.0 odbc_1.3.5 backports_1.4.1 reprex_2.0.1
[11] httr_1.4.3 pillar_1.9.0 rlang_1.1.1 progress_1.2.2 curl_4.3.2
[16] readxl_1.4.0 rstudioapi_0.13 callr_3.7.3 blob_1.2.4 desc_1.4.1
[21] devtools_2.4.3 selectr_0.4-2 bit_4.0.5 munsell_0.5.0 broom_1.0.2
[26] compiler_4.2.0 modelr_0.1.8 pkgconfig_2.0.3 pkgbuild_1.3.1 tidyselect_1.2.0
[31] fansi_1.0.5 crayon_1.5.1 tzdb_0.3.0 dbplyr_2.4.0 withr_2.5.2
[36] brio_1.1.3 grid_4.2.0 jsonlite_1.8.0 gtable_0.3.0 lifecycle_1.0.4
[41] DBI_1.1.3 magrittr_2.0.3 scales_1.2.1 cli_3.6.1 stringi_1.7.12
[46] cachem_1.0.6 remotes_2.4.2 fs_1.6.3 testthat_3.1.4 snakecase_0.11.0
[51] ellipsis_0.3.2 generics_0.1.3 vctrs_0.6.4 tools_4.2.0 bit64_4.0.5
[56] glue_1.6.2 hms_1.1.3 pkgload_1.2.4 processx_3.8.0 fastmap_1.1.0
[61] timechange_0.1.1 colorspace_2.0-3 sessioninfo_1.2.2 memoise_2.0.1 haven_2.5.0
[66] usethis_2.1.6