Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with tm_team_transfer_balances function #402

Open
pataq21 opened this issue Oct 21, 2024 · 1 comment
Open

Issue with tm_team_transfer_balances function #402

pataq21 opened this issue Oct 21, 2024 · 1 comment

Comments

@pataq21
Copy link

pataq21 commented Oct 21, 2024

I encountered the following error while trying to use the function tm_team_transfer_balances:

library(worldfootballR)

tm_team_transfer_balances(
  start_year = 2021, 
  league_url = "https://www.transfermarkt.com/premier-league/startseite/wettbewerb/GB1"
)
#> Error in `dplyr::mutate()`:
#> ℹ In argument: `expenditure_euros = gsub("Expenditure: ", "",
#>   .data[["expenditure_euros"]])`.
#> Caused by error in `.data[["expenditure_euros"]]`:
#> ! Column `expenditure_euros` not found in `.data`.

I am using version ‘0.6.6.1’
I noticed a similar issue in the past (#228) and suspect that the HTML structure on the website might have changed again, as it did previously. This could be affecting the scraping process within the function.

Could you please look into this? Thank you!

@JaseZiv
Copy link
Owner

JaseZiv commented Nov 25, 2024

Can you confirm this still isn't working? I haven't been able to recreate your issue:

library(worldfootballR)

tm <- tm_team_transfer_balances(
  start_year = 2021, 
  league_url = "https://www.transfermarkt.com/premier-league/startseite/wettbewerb/GB1"
)

dplyr::glimpse(tm)

# Rows: 20
# Columns: 8
# $ country           <chr> "England", "England", "England", "E…
# $ league            <chr> "Premier League", "Premier League",…
# $ season            <chr> "Arsenal FC", "Arsenal FC", "Arsena…
# $ squad             <chr> "Arsenal FC", "Aston Villa", "Brent…
# $ expenditure_euros <dbl> 167400000, 129800000, 38200000, 750…
# $ income_euros      <dbl> 31400000, 127000000, 1000000, 78800…
# $ avg_age_out       <dbl> 25.9, 26.6, 23.5, 23.9, 25.8, 26.4,…
# $ avg_age_in        <dbl> 22.7, 25.1, 23.8, 22.5, 26.4, 26.0,…

sessionInfo()
# R version 4.4.0 (2024-04-24)
# Platform: aarch64-apple-darwin20
# Running under: macOS Sonoma 14.4
# 
# Matrix products: default
# BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
# LAPACK: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.12.0
# 
# locale:
#   [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
# 
# time zone: Australia/Melbourne
# tzcode source: internal
# 
# attached base packages:
#   [1] stats     graphics  grDevices utils     datasets  methods  
# [7] base     
# 
# other attached packages:
#   [1] worldfootballR_0.6.6.0001
# 
# loaded via a namespace (and not attached):
#   [1] jsonlite_1.8.8    selectr_0.4-2     dplyr_1.1.4      
# [4] compiler_4.4.0    crayon_1.5.2      promises_1.3.0   
# [7] tidyselect_1.2.1  Rcpp_1.0.12       xml2_1.3.6       
# [10] stringr_1.5.1     snakecase_0.11.1  tidyr_1.3.1      
# [13] later_1.3.2       progress_1.2.3    fastmap_1.1.1    
# [16] readr_2.1.5       R6_2.5.1          generics_0.1.3   
# [19] curl_5.2.1        tibble_3.2.1      janitor_2.2.0    
# [22] lubridate_1.9.3   pillar_1.9.0      tzdb_0.4.0       
# [25] rlang_1.1.3       websocket_1.4.1   utf8_1.2.4       
# [28] stringi_1.8.3     timechange_0.3.0  cli_3.6.2        
# [31] magrittr_2.0.3    ps_1.7.6          processx_3.8.4   
# [34] rvest_1.0.4       rstudioapi_0.16.0 hms_1.1.3        
# [37] lifecycle_1.0.4   chromote_0.2.0    prettyunits_1.2.0
# [40] vctrs_0.6.5       glue_1.7.0        fansi_1.0.6      
# [43] purrr_1.0.2       httr_1.4.7        tools_4.4.0      
# [46] pkgconfig_2.0.3  
# > sessionInfo()
# R version 4.4.0 (2024-04-24)
# Platform: aarch64-apple-darwin20
# Running under: macOS Sonoma 14.4
# 
# Matrix products: default
# BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib 
# LAPACK: /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.12.0
# 
# locale:
#   [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
# 
# time zone: Australia/Melbourne
# tzcode source: internal
# 
# attached base packages:
#   [1] stats     graphics  grDevices utils     datasets  methods   base     
# 
# other attached packages:
#   [1] worldfootballR_0.6.6.0001
# 
# loaded via a namespace (and not attached):
#   [1] jsonlite_1.8.8    selectr_0.4-2     dplyr_1.1.4       compiler_4.4.0    crayon_1.5.2      promises_1.3.0   
# [7] tidyselect_1.2.1  Rcpp_1.0.12       xml2_1.3.6        stringr_1.5.1     snakecase_0.11.1  tidyr_1.3.1      
# [13] later_1.3.2       progress_1.2.3    fastmap_1.1.1     readr_2.1.5       R6_2.5.1          generics_0.1.3   
# [19] curl_5.2.1        tibble_3.2.1      janitor_2.2.0     lubridate_1.9.3   pillar_1.9.0      tzdb_0.4.0       
# [25] rlang_1.1.3       websocket_1.4.1   utf8_1.2.4        stringi_1.8.3     timechange_0.3.0  cli_3.6.2        
# [31] magrittr_2.0.3    ps_1.7.6          processx_3.8.4    rvest_1.0.4       rstudioapi_0.16.0 hms_1.1.3        
# [37] lifecycle_1.0.4   chromote_0.2.0    prettyunits_1.2.0 vctrs_0.6.5       glue_1.7.0        fansi_1.0.6      
# [43] purrr_1.0.2       httr_1.4.7        tools_4.4.0       pkgconfig_2.0.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants