abhiamishra / ggshakeR

An analysis and visualization R package that works with publicly available soccer data
https://abhiamishra.github.io/ggshakeR/
MIT License
112 stars 14 forks source link

Issues with Pizza plot #89

Closed Zakgas closed 2 years ago

Zakgas commented 2 years ago

Hi,

I want to do a pizza plot comparison between two players, but I've got the following error:

Error in strwrap(string) : argument "string" is missing, with no default In addition: There were 42 warnings (use warnings() to see them)

Any help would be much appreciated.

Zakariah

harshkrishna17 commented 2 years ago

@Zakgas Could you please specify which version of ggshakeR you are using. Also please post the results of running sessionInfo() on your system.

harshkrishna17 commented 2 years ago

@Zakgas please tell us if you faced any errors while scraping the data

Zakgas commented 2 years ago

Hi,

No problem with web-scraping since I've included the time_pause function

ggshakeR version: devtools::install_github("abhiamishra/ggshakeR@0.1.2")

sessionInfo() -- see below

R version 4.1.2 (2021-11-01)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Monterey 12.4

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.1/Resources/lib/libRlapack.dylib

locale:
[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] stringb_0.1.17            ggtext_0.1.1              stringi_1.7.6            
 [4] ggpubr_0.4.0.999          rvest_1.0.2               showtext_0.9-5           
 [7] showtextdb_3.0            sysfonts_0.8.8            scales_1.2.0             
[10] magick_2.7.3              ggforce_0.3.3             ggrepel_0.9.1            
[13] lubridate_1.8.0           forcats_0.5.1             stringr_1.4.0            
[16] dplyr_1.0.9               purrr_0.3.4               readr_2.1.2              
[19] tidyr_1.2.0               tibble_3.1.7              ggplot2_3.3.6            
[22] tidyverse_1.3.1           understatr_1.0.1.9000     worldfootballR_0.5.6.3000
[25] ggshakeR_0.1.2           

loaded via a namespace (and not attached):
 [1] colorspace_2.0-3  selectr_0.4-2     ggsignif_0.6.3    ellipsis_0.3.2    qdapRegex_0.7.2  
 [6] rprojroot_2.0.3   snakecase_0.11.0  fs_1.5.2          gridtext_0.1.4    rstudioapi_0.13  
[11] farver_2.1.0      remotes_2.4.2     fansi_1.0.3       xml2_1.3.3        ggh4x_0.2.1.9000 
[16] cachem_1.0.6      wesanderson_0.3.6 RcppRoll_0.3.0    polyclip_1.10-0   pkgload_1.2.4    
[21] jsonlite_1.8.0    broom_0.7.12      gganimate_1.0.7   dbplyr_2.1.1      compiler_4.1.2   
[26] httr_1.4.2        backports_1.4.1   assertthat_0.2.1  fastmap_1.1.0     cli_3.3.0        
[31] tweenr_1.0.2      prettyunits_1.1.1 tools_4.1.2       gtable_0.3.0      glue_1.6.2       
[36] Rcpp_1.0.8.3      carData_3.0-5     cellranger_1.1.0  vctrs_0.4.1       ps_1.6.0         
[41] brio_1.1.3        testthat_3.1.3    lifecycle_1.0.1   devtools_2.4.3    rstatix_0.7.0    
[46] MASS_7.3-56       zoo_1.8-10        hms_1.1.1         curl_4.3.2        memoise_2.0.1    
[51] gridExtra_2.3     desc_1.4.1        TTR_0.24.3        pkgbuild_1.3.1    rlang_1.0.2      
[56] pkgconfig_2.0.3   lattice_0.20-45   cowplot_1.1.1     processx_3.5.3    tidyselect_1.1.2 
[61] here_1.0.1        magrittr_2.0.3    ggsoccer_0.1.6    R6_2.5.1          generics_0.1.2   
[66] DBI_1.1.3         pillar_1.7.0      haven_2.4.3       withr_2.5.0       xts_0.12.1       
[71] abind_1.4-5       janitor_2.1.0     modelr_0.1.8      crayon_1.5.1      car_3.0-12       
[76] utf8_1.2.2        tzdb_0.3.0        viridis_0.6.2     progress_1.2.2    usethis_2.1.5    
[81] grid_4.1.2        readxl_1.4.0      callr_3.7.0       reprex_2.0.1      munsell_0.5.0    
[86] ggbraid_0.2.2     viridisLite_0.4.0 sessioninfo_1.2.2 
abhiamishra commented 2 years ago

Can you please try downloading the latest version - the fix might be available in the latest version of the package

Zakgas commented 2 years ago

Hi,

Which is the latest version?

harshkrishna17 commented 2 years ago

You can simply run

devtools::install_github("abhiamishra/ggshakeR")
Zakgas commented 2 years ago

I did that but there's still an error

harshkrishna17 commented 2 years ago

Maybe you could also update your R to version 4.2.0 ?

Zakgas commented 2 years ago

Ok, I will try to update and let you know.

Zakgas commented 2 years ago

I've updated R to the latest version but the issue is still there

harshkrishna17 commented 2 years ago

Could you please share a reproducible example of the error? (The complete code you are using)

Zakgas commented 2 years ago

Please see below

devtools::install_github("abhiamishra/ggshakeR")
library(ggshakeR)
library(worldfootballR)
library(understatr)
library(tidyverse)
library(lubridate)
library(ggrepel)
library(ggforce)
library(magick)
library(scales)
library(lubridate)
library(showtext)
library(dplyr)
library(stringr)
library(ggplot2)
library(rvest)
library(ggpubr)
library(stringi)
library(ggpubr)
library(ggtext)
library(stringb)
library(base)

# Comparison: Bellingham v Barella

Jude <- fb_player_scouting_report("https://fbref.com/en/players/57d88cf9/Jude-Bellingham", pos_versus = "primary", time_pause = 5)

Nicolo <- fb_player_scouting_report("https://fbref.com/en/players/6928979a/Nicolo-Barella", pos_versus = "primary", time_pause = 5)

BelBar <- rbind(Jude, Nicolo)

RM <- plot_pizza(data = BelBar, type = "comparison", template = "midfielder",
                          player_1 = "Jude Bellingham", player_2 = "Nicolo Barella", 
                          season_player_1 = "Last 365 Days", season_player_2 = "Last 365 Days",
                          color_compare = "red", theme = "white")
RM

ggsave("/Volumes/GASSAZ/Portfolio/Football/BarellinghamPizza.png", width = 2900, height = 2800, units = "px")
harshkrishna17 commented 2 years ago

Hey @Zakgas, I cannot seem to be able to reproduce the error on my system. Could you please send your sessionInfo() once again. Maybe its worth a shot to uninstall and reinstall R and RStudio.

Zakgas commented 2 years ago

Hi

See below

There's no need to uninstall and reinstall as I updated R, so I will try it on another device

R version 4.2.1 (2022-06-23)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Monterey 12.4

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib

locale:
[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] stringb_0.1.17        ggtext_0.1.1          stringi_1.7.6         ggpubr_0.4.0          rvest_1.0.2           showtext_0.9-5       
 [7] showtextdb_3.0        sysfonts_0.8.8        scales_1.2.0          magick_2.7.3          ggforce_0.3.3         ggrepel_0.9.1        
[13] lubridate_1.8.0       forcats_0.5.1         stringr_1.4.0         dplyr_1.0.9           purrr_0.3.4           readr_2.1.2          
[19] tidyr_1.2.0           tibble_3.1.7          ggplot2_3.3.6         tidyverse_1.3.1       understatr_1.0.1.9000 worldfootballR_0.5.6 
[25] ggshakeR_0.1.9999    

loaded via a namespace (and not attached):
 [1] httr_1.4.3       jsonlite_1.8.0   carData_3.0-5    here_1.0.1       modelr_0.1.8     assertthat_0.2.1 TTR_0.24.3       cellranger_1.1.0
 [9] pillar_1.7.0     backports_1.4.1  lattice_0.20-45  glue_1.6.2       ggsignif_0.6.3   gridtext_0.1.4   polyclip_1.10-0  snakecase_0.11.0
[17] colorspace_2.0-3 pkgconfig_2.0.3  qdapRegex_0.7.5  broom_0.8.0      haven_2.5.0      tweenr_1.0.2     tzdb_0.3.0       generics_0.1.2  
[25] farver_2.1.0     car_3.1-0        ellipsis_0.3.2   withr_2.5.0      janitor_2.1.0    cli_3.3.0        magrittr_2.0.3   crayon_1.5.1    
[33] readxl_1.4.0     fs_1.5.2         fansi_1.0.3      MASS_7.3-57      rstatix_0.7.0    xts_0.12.1       xml2_1.3.3       tools_4.2.1     
[41] hms_1.1.1        lifecycle_1.0.1  munsell_0.5.0    reprex_2.0.1     ggsoccer_0.1.6   compiler_4.2.1   rlang_1.0.3      grid_4.2.1      
[49] rstudioapi_0.13  gtable_0.3.0     abind_1.4-5      DBI_1.1.3        curl_4.3.2       R6_2.5.1         gridExtra_2.3    zoo_1.8-10      
[57] utf8_1.2.2       rprojroot_2.0.3  Rcpp_1.0.8.3     vctrs_0.4.1      dbplyr_2.2.1     tidyselect_1.1.2
harshkrishna17 commented 2 years ago

You probably should. As far as I can tell there is no error within the function. On top of that, the function showing the error (strwrap) isn't even used within our package.

Zakgas commented 2 years ago

It's too tedious, I will try on another device

Many thanks for your help

harshkrishna17 commented 2 years ago

Please let us know if it worked on another device! Another suggestion I have is that you have too many packages loaded into your system at one time. It might be interfering with a lot of stuff. Maybe you could try running the function with only the ggshakeR and worldfootballR packages loaded.

Zakgas commented 2 years ago

Yes, it does work on my laptop. I have no idea why it doesn't work on my desktop. No worries, many thanks for your help

harshkrishna17 commented 2 years ago

Great to hear!