Coder Social home page Coder Social logo

statsbomb / statsbombr Goto Github PK

View Code? Open in Web Editor NEW
261.0 21.0 74.0 256 KB

This repository is an R package to easily stream StatsBomb data from the API using your log in credentials or from the Open Data GitHub repository cost free into R .

R 100.00%

statsbombr's Introduction

StatsBombR

By: StatsBomb

Updated March 22, 2020.

This repository is an R package to easily stream StatsBomb data into R using your log in credentials for the API or free data from our GitHub page. API access is for paying customers only

This package offers a parallel option to most computationally expensive functions. However, it is currently only designed for Windows.

Installation Instructions:

  1. Please first make sure you are on version 3.6.2 or later of R before attempting to install
  2. If not yet installed into R, run: install.packages("devtools")
  3. Then, install this R package as: devtools::install_github("statsbomb/StatsBombR")
  4. Finally, library(StatsBombR)

This package depends on several other packages in order for all functions to run. Therefore, if you have problems with any functions or with installing the package, it is likely due to package dependencies.

Free Data

Free Data Instructions:

Welcome to the Free Data Offerings from StatsBomb Services.

This package is reading in the open access dat found on https://github.com/statsbomb/open-data. Below you will find a list of the functions used to quickly read in all open data currently available. Check back often as new data is regularly added.

Free Data Description and Privacy Policy

StatsBomb are committed to sharing new data and research publicly to enhance understanding of the game of Football. We want to actively encourage new research and analysis at all levels. Therefore we have made certain leagues of StatsBomb Data freely available for public use for research projects and genuine interest in football analytics.

StatsBomb are hoping that by making data freely available, we will extend the wider football analytics community and attract new talent to the industry. We would like to collect some basic personal information about users of our data. By giving us your email address, it means we will let you know when we make more data, tutorials and research available. We will store the information in accordance with our Privacy Policy and the GDPR.

Whilst we are keen to share data and facilitate research, we also urge you to be responsible with the data. Please register your details on https://www.statsbomb.com/resource-centre and read our User Agreement carefully.

Terms & Conditions

By using this repository, you are agreeing to the user agreement.

If you publish, share or distribute any research, analysis or insights based on this data, please state the data source as StatsBomb and use our logo.

To read in all free events available:

StatsBombData <- free_allevents()

To read in all of the free competitions we offer simply run:

FreeCompetitions()

or, for use in other functions, store it as a data frame object:

Comp <- FreeCompetitions()

To read in the free matches available:

Matches <- FreeMatches(Comp)

To read in free events for a certain game:

get.matchFree(Matches[1,])

It is important to note, that the argument here is the entire row returns from "FreeMatches", this is because there is information from each match observation that is needed in the get.matchFree function.

API Data

API Access Instructions:

API access is for paying customers only

To read in the competitions available through StatsBomb, run:

  1. competitions <- competitions(username, password)

To read in the matches available in each competition, run:

  1. matches <- get.matches(username, password, season_id, competition_id)

To read in all of the matches for various competitions.

  1. Pull Competitions From the API: comps <- competitions(username, password)
  2. Filter for the competitions you want: EuropeComps <- comps %>% filter(country_name == "Europe")
  3. Create a matrix of the competition and season ids: competitionmatrix <- as.matrix(EuropeComps[,1:2])
  4. Pull all of the matches: Matches <- MultiCompMatches(username, password, competitionmatrix)

To read in events for one game, simply run:

  1. StatsBombData <- get.events(username, password, match_id)

Note: A previous version of this function was named get.match(), get.match() is now deprecated).

To read in events for multiple games, run:

  1. Create a vector of match IDs:matchids <- matchesvector(username, password, season_id, competition_id)
  2. StatsBombData <- allevents(username, password, matchids)

Note: See documentation for additional parameters available to access different API versions, run in parallel or not, choose a specific number of cores. (A previous version of this function was named allmatches(), allmatches() is now deprecated).

To read in all of the events for various competitions.

  1. Pull Competitions From the API: comps <- competitions(username, password)
  2. Filter for the competitions you want: EuropeComps <- comps %>% filter(country_name == "Europe")
  3. Create a matrix of the competition and season ids: competitionmatrix <- as.matrix(EuropeComps[,1:2])
  4. Pull all of the events: Events <- MultiCompEvents(username, password, competitionmatrix)

To read in the lineups for one game, run:

  1. lineups <- get.lineups(username, password, match_id)

To read in multiple lineups, run:

  1. matchids <- matchesvector(username, password, season_id, competition_id)
  2. StatsBombLineups <- allineups(username, password, matchids, parallel = T)

To unnest all of the lineups:

StatsBombLineups <- cleanlineups(StatsBombLineups)

Data Cleaning Helpers:

Although JSON files can often be a pain to clean, especially due to nested data frames, these helper functions may make your data wrangling much easier.

To clean all of the data at once:

StatsBombData <- allclean(StatsBombData)

This function cleans the data in one line of code by running each of the functions below sequentially.

To clean all of the location variables simply run:

StatsBombData <- cleanlocations(StatsBombData)

Please note all location variables must be present in the data set. This function will not work with a subset of variables (i.e. if any location variables are missing).

To add the goalkeeper information from the freeze frame:

StatsBombData <- goalkeeperinfo(StatsBombData)

Please note that additional information is located under type.name == "Goal Keeper" and within the Freeze Frames.

To add additional shot information:

StatsBombData <- shotinfo(StatsBombData)

To extract some information from the freeze frame:

StatsBombData <- freezeframeinfo(StatsBombData)

Description of these variables:

  • Density is calculated as the aggregated inverse distance for each defender behind the ball.
  • Density in the cone is the density filtered for only defenders who are in the cone between the shooter, and each goal post.

To format the elapsed time from the start of a match:

StatsBombData <- formatelapsedtime(StatsBombData)

To add in information about the current possession within a match:

StatsBombData <- possessioninfo(StatsBombData)

Final Notes:

  • Some of the cleaning functions above depend on variables created in the functions presented before them. In order to be safe, please clean your data in the order that is presented in this document.
  • Please re-install frequently, as new functions and bug fixes will be added regularly.
  • As always, check out the Rdocumentation for each function (ex. ?StatsBombFreeEvents()) for more specific description.
  • Please contact [email protected] with bugs and suggestions.

statsbombr's People

Contributors

deepxg avatar euandewar avatar scotty779 avatar yamstats avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

statsbombr's Issues

getallinfo() fails in some cases due to first element of myList being NULL

I'd make this a pull request but I'm running a much different fork of the package for use with R <v5.0.

getallinfo() is failing currently for the latest FA WSL fixtures due to some weirdness in match_id == 19790:

Reprex:

library(dplyr)
library(StatsBombR)

# get all available fixtures from StatsBomb
fixture <- FreeMatches(37) %>% 
  filter(match_id == 19790)

getallinfo(fixture)

# Error in matrix(ncol = ncol(myList[[1]]), nrow = 1) : non-numeric matrix extent

Going through step-by-step, it's functions goalkeeperinfo() and freezeframeinfo() that fail; in both cases seems to be due to the first entry of Shots.FF being NULL, causing the fixnull function to fail.

A simple fix is to use the first non-null of myList in fixnull, changing line 13 of goalkeeperinfo.R and line 23 of freezeframeinfo from:

return(setNames(data.frame(matrix(ncol = ncol(myList[[1]]), nrow = 1)), names(myList[[1]])))

to:

return(setNames(data.frame(matrix(ncol = ncol(myList[lengths(myList) != 0][[1]]), nrow = 1)), names(myList[lengths(myList) != 0][[1]])))

Issues installing SDMTools and StatsBombR

Hi there,

When trying to install both 'SDMTools' and 'StatsBombR', I'm getting the following error message:

devtools::install_github("statsbomb/StatsBombR")

Using github PAT from envvar GITHUB_PAT
Downloading GitHub repo statsbomb/StatsBombR@HEAD
Error in utils::download.file(url, path, method = method, quiet = quiet,  :
  cannot open URL 'https://api.github.com/repos/statsbomb/StatsBombR/tarball/HEAD'
devtools::install_github("statsbomb/SDMTools")

Using github PAT from envvar GITHUB_PAT
Downloading GitHub repo statsbomb/SDMTools@HEAD
Error in utils::download.file(url, path, method = method, quiet = quiet,  :
  cannot open URL 'https://api.github.com/repos/statsbomb/SDMTools/tarball/HEAD'

Results of sessionInfo():

R version 4.1.0 (2021-05-18)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Big Sur 10.16

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

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

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

loaded via a namespace (and not attached):
 [1] magrittr_2.0.1    usethis_2.0.1     devtools_2.4.2    pkgload_1.2.1    
 [5] R6_2.5.0          rlang_0.4.11      fastmap_1.1.0     tools_4.1.0      
 [9] pkgbuild_1.2.0    xfun_0.29         sessioninfo_1.1.1 tinytex_0.33     
[13] cli_3.0.1         withr_2.4.2       ellipsis_0.3.2    remotes_2.4.0    
[17] rprojroot_2.0.2   lifecycle_1.0.0   crayon_1.4.1      processx_3.5.2   
[21] purrr_0.3.4       callr_3.7.0       fs_1.5.0          ps_1.6.0         
[25] curl_4.3.2        testthat_3.0.4    memoise_2.0.0     glue_1.4.2       
[29] cachem_1.0.5      compiler_4.1.0    desc_1.3.0        prettyunits_1.1.1

Error when trying to install StatsBombR

Hiya,

when i try to run
devtools::install_github("statsbomb/StatsBombR")

I get the following in RStudio

Warning message:
In i.p(...) :
installation of package 'FILEPATH’ had non-zero exit status

does anyone know how to address this?

Issue with Installing statsbombR

I'm a novice with R, and encountered an issue with installing the statsbombR package.

The error message I keep getting is shown below-

fkSujeIP jpg-large

How should I go about resolving this issue?

Any help is appreciated!

Parallel version

Can I suggest dropping the requirement for parallel >= 3.5.0 to >= 3.4 in DESCRIPTION?

It doesn't seem to make any difference and >= 3.5 forces you to run the latest version of R, which isn't easily available yet on Linux. I gave up getting R 3.5 to run, lowered the parallel version number and it's working fine.

Minimum >= 3.5.0 sends any Ubuntu Linux users on a difficult roundabout route to try to upgrade their R version.

Error with the `StatsBombFreeEvents` function

Hi! I was trying to scrape free event data from the StatsBombR package and ran into an error with the StatsBombFreeEvents() function. The entire code so far is the following.

library(StatsBombR)

Comp <- FreeCompetitions() %>%
  filter(competition_id == 11 & season_name == "2014/2015")
Matches <- FreeMatches(Comp)
StatsBombData <- StatsBombFreeEvents(MatchesDF = Matches, Parallel = TRUE)

The error I get from running the last line is this.

Error in if (MatchesDF == "ALL") { : the condition has length > 1

To my knowledge this error is caused in the latest version of R i.e 4.2.0. To that, here is my sessionInfo().

> sessionInfo()
R version 4.2.0 (2022-04-22 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 22000)

Matrix products: default

locale:
[1] LC_COLLATE=English_India.utf8 
[2] LC_CTYPE=English_India.utf8   
[3] LC_MONETARY=English_India.utf8
[4] LC_NUMERIC=C                  
[5] LC_TIME=English_India.utf8    

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

other attached packages:
 [1] StatsBombR_0.1.0  tidyr_1.2.0       sp_1.5-0         
 [4] purrr_0.3.4       jsonlite_1.8.0    httr_1.4.3       
 [7] doParallel_1.0.17 iterators_1.0.14  foreach_1.5.2    
[10] RCurl_1.98-1.7    rvest_1.0.2       tibble_3.1.7     
[13] stringr_1.4.0     stringi_1.7.6     dplyr_1.0.9      

loaded via a namespace (and not attached):
 [1] tidyselect_1.1.2  remotes_2.4.2     lattice_0.20-45  
 [4] vctrs_0.4.1       generics_0.1.2    testthat_3.1.4   
 [7] usethis_2.1.6     utf8_1.2.2        rlang_1.0.2      
[10] pkgbuild_1.3.1    R.oo_1.25.0       pillar_1.7.0     
[13] glue_1.6.2        withr_2.5.0       DBI_1.1.2        
[16] R.utils_2.11.0    sessioninfo_1.2.2 lifecycle_1.0.1  
[19] SDMTools_1.1-222  R.methodsS3_1.8.2 devtools_2.4.3   
[22] codetools_0.2-18  memoise_2.0.1     callr_3.7.0      
[25] fastmap_1.1.0     ps_1.7.0          curl_4.3.2       
[28] fansi_1.0.3       cachem_1.0.6      desc_1.4.1       
[31] pkgload_1.2.4     fs_1.5.2          brio_1.1.3       
[34] processx_3.6.0    grid_4.2.0        rprojroot_2.0.3  
[37] cli_3.3.0         tools_4.2.0       bitops_1.0-7     
[40] magrittr_2.0.3    crayon_1.5.1      pkgconfig_2.0.3  
[43] ellipsis_0.3.2    xml2_1.3.3        prettyunits_1.1.1
[46] assertthat_0.2.1  rstudioapi_0.13   R6_2.5.1         
[49] compiler_4.2.0   
> 

typo in readme code

StatsBombLineups <- allineups(username, password, matchids, parallel = T)

should be

StatsBombLineups <- alllineups(username, password, matchids, parallel = T)

very nitpicking but I seem to forget the function and copy it every 2 weeks or so

SDMTools problem

Hi,

I am trying to install the StatsBombR package but I have the following warning:

Installing 13 packages: dplyr, rvest, RCurl, doParallel, foreach, SDMTools, sp, tidyr, iterators, tidyselect, plogr, selectr, bitops
Error: Failed to install 'StatsBombR' from GitHub:(convertido del aviso) package ‘SDMTools’ is not available (for R version 3.6.3)

It seems that there exists an issue with SDMTools package.

I would be very thankful if somebody could help me.

Thank you very much!

1st time user

trying to access free data from stats bomb and not sure how/where to download pre built R package. Please advise! I'm a coach and this is new to me.

Timeout when installing

Hi all

I'm currently getting the below error when trying to install StatsBombR. Does anybody have any solutions - is it possible to download a ZIP file of the package for example?

Thanks!

devtools::install_github("statsbomb/StatsBombR")
Error: Failed to install 'unknown package' from GitHub:
Timeout was reached: [api.github.com] Connection timed out after 10000 milliseconds

Problems installing statsbombR

Hi,

I'm trying to install the package from GitHub and I get the following error.

Skipping SDMTools, it is already being installed
✔ checking for file ‘/private/var/folders/w3/wdd8d9jx7ysdfgsk3gbbx8zh0000gn/T/RtmpYuXL4V/remotes779a35e410de/statsbomb-StatsBombR-b0a5ee7/DESCRIPTION’ ...
─ preparing ‘StatsBombR’:
✔ checking DESCRIPTION meta-information
─ checking for LF line-endings in source and make files and shell scripts
─ checking for empty or unneeded directories
─ building ‘StatsBombR_0.1.0.tar.gz’

  • installing source package ‘StatsBombR’ ...
    ** using staged installation
    ** R
    ** byte-compile and prepare package for lazy loading
    Error: (converted from warning) package ‘doParallel’ was built under R version 4.0.5
    Execution halted
    ERROR: lazy loading failed for package ‘StatsBombR’
  • removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/StatsBombR’
    Error: Failed to install 'StatsBombR' from GitHub:
    (converted from warning) installation of package ‘/var/folders/w3/wdd8d9jx7ysdfgsk3gbbx8zh0000gn/T//RtmpYuXL4V/file779a4d86a6be/StatsBombR_0.1.0.tar.gz’ had non-zero exit status

I have the latest R version for Mac and devtools and SDMTools are installed and load but I find a problem with doParallel (which I checked and I have version 1.0.17).

Any ideas?

Problem installing StatsBombR package

I am having a problem too. Done all the install.packages stuff, but still getting this:

Downloading GitHub repo statsbomb/StatsBombR@HEAD
Error: Failed to install 'StatsBombR' from GitHub:
Git does not seem to be installed on your system.

What it could be? :(

Two missing matches in FA WSL

Event data for two matches in the FA WSL aren't available in StatsBombR and are not listed in the 37.json matches file:

Bristol City v Yeovil (2019-01-27)
Birmingham City v Brighton (2018-09-19)

Unable to install StatsBombR package

Hello,

I’m new to R and StatsBomb Data. I’m trying to follow the steps of your guide to use free StatsBomb Data, but when I try to install the StatsBombR package I always get an error message.

I tried this code:

install.packages("devtools")
devtools::install_github("statsbomb/SDMTools")

and this code:

install.packages("remotes")
remotes::install_version("SDMTools", "1.1-221")
devtools::install_github("statsbomb/StatsBombR")

But the same message appears:

Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
there is no package called ‘httpuv’

Is there anyway to surpass this?

Thank you very much for your help

Novice with R - Please Help

Hello,
I please need help getting started. It seems like R is the recommended path and I am following all instructions from the Statsbomb R ppt and the https://github.com/statsbomb/StatsBombR link. From what I can tell, the only issue I am having is with the StatsbombR package portion. Below is the error message I receive. Do I have to click on any of the packages previously downloaded in order to download this - such devtools? as Any advice will help greatly.

`> devtools::install_github("statsbomb/StatsBombR");
Downloading GitHub repo statsbomb/StatsBombR@master
Downloading git repo https://github.com/cran/SDMTools.git
√ checking for file 'C:\Users\USER' Surface\AppData\Local\Temp\Rtmp6H80rl\file247833b2144e/DESCRIPTION' (484ms)

preparing 'SDMTools': (851ms)
√ checking DESCRIPTION meta-information ...
cleaning src
checking for LF line-endings in source and make files and shell scripts (377ms)
checking for empty or unneeded directories
building 'SDMTools_1.1-221.2.tar.gz'
Installing package into ‘C:/Users/USER Surface/Documents/R/win-library/4.0’
(as ‘lib’ is unspecified)

installing source package 'SDMTools' ...
** using staged installation
** libs
*** arch - i386
/mingw32/bin/gcc -I"C:/PROGRA1/R/R-401.2/include" -DNDEBUG -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c ConnectedComponentLabelling.c -o ConnectedComponentLabelling.o
/mingw32/bin/gcc -I"C:/PROGRA1/R/R-401.2/include" -DNDEBUG -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c getmin.c -o getmin.o
/mingw32/bin/gcc -I"C:/PROGRA1/R/R-401.2/include" -DNDEBUG -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c movewindow.c -o movewindow.o
/mingw32/bin/gcc -I"C:/PROGRA1/R/R-401.2/include" -DNDEBUG -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c patchstats.c -o patchstats.o
/mingw32/bin/gcc -I"C:/PROGRA1/R/R-401.2/include" -DNDEBUG -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c pointinpolygon.c -o pointinpolygon.o
/mingw32/bin/gcc -I"C:/PROGRA1/R/R-401.2/include" -DNDEBUG -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c slope.aspect.c -o slope.aspect.o
/mingw32/bin/gcc -I"C:/PROGRA1/R/R-401.2/include" -DNDEBUG -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c vincenty.geodesics.c -o vincenty.geodesics.o
/mingw32/bin/gcc -I"C:/PROGRA1/R/R-401.2/include" -DNDEBUG -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c writeasciidata.c -o writeasciidata.o
/mingw32/bin/gcc -shared -s -static-libgcc -o SDMTools.dll tmp.def ConnectedComponentLabelling.o getmin.o movewindow.o patchstats.o pointinpolygon.o slope.aspect.o vincenty.geodesics.o writeasciidata.o -LC:/PROGRA1/R/R-401.2/bin/i386 -lR
installing to C:/Users/USER Surface/Documents/R/win-library/4.0/00LOCK-SDMTools/00new/SDMTools/libs/i386

*** arch - x64
/mingw64/bin/gcc -I"C:/PROGRA1/R/R-401.2/include" -DNDEBUG -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c ConnectedComponentLabelling.c -o ConnectedComponentLabelling.o
/mingw64/bin/gcc -I"C:/PROGRA1/R/R-401.2/include" -DNDEBUG -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c getmin.c -o getmin.o
/mingw64/bin/gcc -I"C:/PROGRA1/R/R-401.2/include" -DNDEBUG -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c movewindow.c -o movewindow.o
/mingw64/bin/gcc -I"C:/PROGRA1/R/R-401.2/include" -DNDEBUG -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c patchstats.c -o patchstats.o
/mingw64/bin/gcc -I"C:/PROGRA1/R/R-401.2/include" -DNDEBUG -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c pointinpolygon.c -o pointinpolygon.o
/mingw64/bin/gcc -I"C:/PROGRA1/R/R-401.2/include" -DNDEBUG -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c slope.aspect.c -o slope.aspect.o
/mingw64/bin/gcc -I"C:/PROGRA1/R/R-401.2/include" -DNDEBUG -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c vincenty.geodesics.c -o vincenty.geodesics.o
/mingw64/bin/gcc -I"C:/PROGRA1/R/R-401.2/include" -DNDEBUG -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c writeasciidata.c -o writeasciidata.o
/mingw64/bin/gcc -shared -s -static-libgcc -o SDMTools.dll tmp.def ConnectedComponentLabelling.o getmin.o movewindow.o patchstats.o pointinpolygon.o slope.aspect.o vincenty.geodesics.o writeasciidata.o -LC:/PROGRA1/R/R-401.2/bin/x64 -lR
installing to C:/Users/USER Surface/Documents/R/win-library/4.0/00LOCK-SDMTools/00new/SDMTools/libs/x64
** R
** byte-compile and prepare package for lazy loading
Error: unexpected symbol in "tools:::makeLazyLoading("SDMTools", 'C:/Users/USER Surface"
Execution halted
ERROR: lazy loading failed for package 'SDMTools'

removing 'C:/Users/USER Surface/Documents/R/win-library/4.0/SDMTools'
Error: Failed to install 'StatsBombR' from GitHub:
Failed to install 'unknown package' from Git:
(converted from warning) installation of package ‘C:/Users/USER~1/AppData/Local/Temp/Rtmp6H80rl/file247837fd279/SDMTools_1.1-221.2.tar.gz’ had non-zero exit status

Issues Installing StatsBombR Package

Hi,

I keep encountering the error message below when I attempt to install the StatsBombR package on R Studio:

Error: Failed to install 'StatsBombR' from GitHub:
Git does not seem to be installed on your system.

I was able to install the other package outlined in the set-up instructions without any problems:

devtools::install_github("statsbomb/SDMTools")

Is there a reason this package won't install?

Error: parse error: premature EOF

Hello

I am new to statsbomb and R. Believe I got the initial packages installed correctly because it worked smoothly with the free data but when I attempt to use my account to access I am getting this parse errror: Preamture EOF shown below. I have defined username & password and have removed it below for obvious reasons. Any help or direction would be greatly appreciated.

library(tidyverse)
── Attaching packages ─────────────────────────────────────────────── tidyverse 1.3.2 ──
✔ ggplot2 3.3.6 ✔ purrr 0.3.5
✔ tibble 3.1.8 ✔ dplyr 1.0.10
✔ tidyr 1.2.1 ✔ stringr 1.4.1
✔ readr 2.1.3 ✔ forcats 0.5.2
── Conflicts ────────────────────────────────────────────────── >tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
library(StatsBombR)
Loading required package: stringi
Loading required package: rvest

Attaching package: ‘rvest’

The following object is masked from ‘package:readr’:

guess_encoding

Loading required package: RCurl

Attaching package: ‘RCurl’

The following object is masked from ‘package:tidyr’:

complete

Loading required package: doParallel
Loading required package: foreach

Attaching package: ‘foreach’

The following objects are masked from ‘package:purrr’:

accumulate, when

Loading required package: iterators
Loading required package: parallel
Loading required package: httr
Loading required package: jsonlite

Attaching package: ‘jsonlite’

The following object is masked from ‘package:purrr’:

flatten

Loading required package: sp
Warning messages:
1: replacing previous import ‘foreach::when’ by ‘purrr::when’ when loading ‘StatsBombR’
2: replacing previous import ‘jsonlite::flatten’ by ‘purrr::flatten’ when loading ‘StatsBombR’
3: replacing previous import ‘foreach::accumulate’ by ‘purrr::accumulate’ when loading ‘StatsBombR’
username = ""
password = "
"
comps <- competitions(username, password)
Error: parse error: premature EOF

               (right here) ------^"

StatsBombFreeEvents() bug

Copy & pasting the code from the "Working-with-R.pdf" document from StatsBomb,

llibrary(tidyverse)
library(StatsBombR) 

Comp <- FreeCompetitions() %>%
  filter(competition_id==37 & season_name=="2020/2021") 

Matches <- FreeMatches(Comp) 

StatsBombFreeEvents(MatchesDF = Matches, Parallel = T)

produces the error

Error in if (MatchesDF == "ALL") { : the condition has length > 1

which is odd, especially since I didn't type MatchesDF=="ALL" but maybe I'm not understanding the error message. In any case, the tutorial code is not working.

Error with StatsBombData function

When running the following code:
library(tidyverse) library(StatsBombR) Comp <- FreeCompetitions() %>% filter(competition_id==43) Matches <- FreeMatches(Comp) StatsBombData <- StatsBombFreeEvents(MatchesDF = Matches, Parallel = T) StatsBombData = allclean(StatsBombData)

I get this error message:

library(tidyverse)
library(StatsBombR)
Comp <- FreeCompetitions() %>%
filter(competition_id==43)
StatsBombData <- StatsBombFreeEvents(MatchesDF = Matches, Parallel = T)
Error in if (MatchesDF == "ALL") { : the condition has length > 1
StatsBombData = allclean(StatsBombData)
Error in dplyr::select(., -num_range("shot", 1:20)) :
object 'StatsBombData' not found

Is there something wrong with the StatsBomb Free Data? I'm literally pasting the sample code in the "Working with R" guide.

Error

Hola, como están? Después de seguir las instrucciones de instalación

install.packages("devtools")
install.packages("remotes")
remotes::install_version("SDMTools", "1.1-221")

Al llegar a este paso:
devtools::install_github("statsbomb/StatsBombR")

me da el siguiente error:

devtools::install_github("statsbomb/StatsBombR")
Downloading GitHub repo statsbomb/StatsBombR@HEAD
Error: Failed to install 'StatsBombR' from GitHub:
Git does not seem to be installed on your system.

A alguien le paso? se agrede la ayuda
gracias!!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.