worldfootballR Documentation

repository·main·Indexed 20 days ago

https://github.com/jaseziv/worldfootballr

An R package for scraping and extracting football (soccer) data, including match results, player statistics, and transfer information from FBref, Transfermarkt, and Understat. Supports rapid loading of pre-collected datasets via load_ functions and provides tools for extracting advanced statistics like xG.

Tokens
503
Snippets
2
Records
5
Agent score
20%

What's inside worldfootballR

  1. Overview of worldfootballR data sources

    main

    The worldfootballR package is designed to extract football (soccer) results and player statistics from three primary web sources:

    • FBref: Match and season data.
    • Transfermarkt: Player valuations and transfers.
    • Understat: Advanced statistics (e.g., xG).

    Note: Fotmob data is no longer supported as of version v0.6.4 due to changes in their terms of service.

  2. Install worldfootballR from GitHub

    main

    As of June 2024, the CRAN version of worldfootballR is outdated. It is highly recommended to install the latest version directly from GitHub using devtools to ensure you have the most recent updates and data extraction capabilities.

    # install.packages("devtools")
    devtools::install_github("JaseZiv/worldfootballR")
    
    library(worldfootballR)
  3. Load pre-scraped data rapidly

    main
    Since version v0.5.3, the library supports rapid loading of pre-collected datasets using load_ functions. This avoids the need to scrape data manually every time. The pre-collected data is hosted in the worldfootballR_data repository. Refer to the package vignettes for specific examples of available datasets.
  4. Supported Understat leagues

    main

    When using understat_ functions, you can pass the following strings to the league argument to specify the competition:

    • "EPL"
    • "La liga"
    • "Bundesliga"
    • "Serie A"
    • "Ligue 1"
    • "RFPL"
    # Example usage pattern
    # understat_function(league = "EPL", ...)