itscalledsoccer

R package that wraps the ASA API

https://github.com/american-soccer-analysis/itscalledsoccer-r

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (16.4%) to scientific vocabulary

Keywords

api-wrapper itscalledsoccer soccer soccer-api
Last synced: 6 months ago · JSON representation

Repository

R package that wraps the ASA API

Basic Info
Statistics
  • Stars: 10
  • Watchers: 4
  • Forks: 0
  • Open Issues: 2
  • Releases: 8
Topics
api-wrapper itscalledsoccer soccer soccer-api
Created over 3 years ago · Last pushed 10 months ago
Metadata Files
Readme Changelog Funding License Codeowners

README.md

itscalledsoccer

CRAN status R-CMD-check Codecov test coverage <!-- badges: end -->

Overview

itscalledsoccer is a wrapper around the same API that powers the American Soccer Analysis app. It enables R users to programmatically retrieve advanced analytics for their favorite players and teams, with coverage of the following competitions:

  • Major League Soccer
  • National Women's Soccer League
  • USL Championship
  • USL League One
  • USL Super League
  • MLS NEXT Pro
  • North American Soccer League (defunct)

Installation

```r

Install release version from CRAN

install.packages("itscalledsoccer")

Install development version from GitHub

devtools::install_github("American-Soccer-Analysis/itscalledsoccer-r") ```

Getting Started

Initialize the main class with the new method.

r asa_client <- AmericanSoccerAnalysis$new()

If you're in an environment where a proxy server is required, or if you need to need to alter any other CURL options, you can pass any number of httr configs when initializing the class. Use these at your own discretion.

r asa_client <- AmericanSoccerAnalysis$new( httr::config(ssl_verifypeer = 0L), httr::use_proxy("64.251.21.73", 8080) )

Usage

Any of the get_* methods can be used to retrieve the same data made available in the American Soccer Analysis app. Partial matches or abbreviations are accepted for any player or team names. For most methods, arguments must be named. Additionally, dataframes of complete players, teams, games, and more are also available for joining additional information. A variety of examples are below, and full documentation can be found here.

```r

Initialize the main class

asa_client <- AmericanSoccerAnalysis$new() ```

```r

Access dataframes of games, players, teams, and more from the ASA client object created above

allgames <- asaclient$games allteams <- asaclient$teams allplayers <- asaclient$players

see league options

asa_client$LEAGUES ```

```r

Get all players named "Dax"

daxplayers <- asaclient$get_players(names = "Dax") ```

```r

Get cumulative player shot information (i.e., xgoals) from the NWSL over three seasons

see other parameters in package documentation

asaxgoals <- asaclient$getplayerxgoals( leagues = "nwsl", seasonname = c(2021:2023), splitbyseasons = FALSE) head(shotsdf) ```

```r

Get season-by-season shot information (i.e., xgoals) for all players named "Dax" in MLS

asaxgoals <- asaclient$getplayerxgoals( leagues = "mls", playernames = "Dax", splitby_seasons = TRUE )

Join player names

library(dplyr) asaxgoals <- asaxgoals %>% leftjoin(allplayers, by = "player_id") ```

```r

Get player passing information (i.e., xpass) from MLS in 2023

asaxpass <- asaclient$getplayerxpass( leagues = "mls", season_name = 2023)

Get cumulative/career xPass data for all USL League One teams

asaxpass <- asaclient$getteamxpass( leagues = "usl1" ) ```

```r

Get team g+ information (i.e., goals added) from MLS

library(tidyr)

tall version

asagoalsadded <- asaclient$getteamgoalsadded( leagues = "mls", season_name = 2023) %>% tidyr::unnest(data)

wide version

asagoalsadded <- asaclient$getteamgoalsadded( leagues = "mls", seasonname = 2023) %>% tidyr::unnest(data) %>% tidyr::pivotwider( idcols = teamid, namesfrom = actiontype, valuesfrom = c(numactionsfor:goalsadded_against))

Get game-by-game goals added (g+) data for all goalkeepers named "Matt Turner"

asagoalsadded <- asaclient$getgoalkeepergoalsadded( leagues = c("mls", "uslc"), playernames = "Matt Turner", splitby_game = TRUE ) ```

Owner

  • Name: American Soccer Analysis
  • Login: American-Soccer-Analysis
  • Kind: organization

Solving soccer

GitHub Events

Total
  • Create event: 4
  • Issues event: 2
  • Release event: 2
  • Watch event: 2
  • Delete event: 1
  • Issue comment event: 1
  • Push event: 15
  • Pull request review comment event: 4
  • Pull request review event: 12
  • Pull request event: 6
  • Fork event: 1
Last Year
  • Create event: 4
  • Issues event: 2
  • Release event: 2
  • Watch event: 2
  • Delete event: 1
  • Issue comment event: 1
  • Push event: 15
  • Pull request review comment event: 4
  • Pull request review event: 12
  • Pull request event: 6
  • Fork event: 1

Committers

Last synced: over 2 years ago

All Time
  • Total Commits: 74
  • Total Committers: 2
  • Avg Commits per committer: 37.0
  • Development Distribution Score (DDS): 0.027
Past Year
  • Commits: 33
  • Committers: 2
  • Avg Commits per committer: 16.5
  • Development Distribution Score (DDS): 0.03
Top Committers
Name Email Commits
Tyler Richardett t****t@g****m 72
bgrnwd 1****d 2

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 10
  • Total pull requests: 21
  • Average time to close issues: 9 days
  • Average time to close pull requests: 8 days
  • Total issue authors: 3
  • Total pull request authors: 6
  • Average comments per issue: 0.2
  • Average comments per pull request: 0.33
  • Merged pull requests: 20
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 1
  • Pull requests: 9
  • Average time to close issues: 4 days
  • Average time to close pull requests: 15 days
  • Issue authors: 1
  • Pull request authors: 3
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.33
  • Merged pull requests: 8
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • bgrnwd (4)
  • tyler-richardett (4)
  • mattyanselmo (2)
Pull Request Authors
  • tyler-richardett (11)
  • akeaswaran (6)
  • mattyanselmo (2)
  • lvanden (2)
  • olivroy (2)
  • bgrnwd (1)
Top Labels
Issue Labels
enhancement (1) bug (1) documentation (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 453 last-month
  • Total docker downloads: 41,971
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 9
  • Total maintainers: 1
cran.r-project.org: itscalledsoccer

American Soccer Analysis API Client

  • Versions: 9
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 453 Last month
  • Docker Downloads: 41,971
Rankings
Stargazers count: 28.5%
Forks count: 28.8%
Dependent packages count: 29.8%
Average: 32.6%
Dependent repos count: 35.5%
Downloads: 40.6%
Maintainers (1)
Last synced: 6 months ago

Dependencies

DESCRIPTION cran
  • R >= 3.2.0 depends
  • R6 >= 2.5.0 imports
  • clisymbols * imports
  • crayon * imports
  • data.table >= 1.13.0 imports
  • dplyr >= 1.0.0 imports
  • glue >= 1.4.1 imports
  • httpcache >= 1.2.0 imports
  • httr >= 1.4.2 imports
  • jsonlite >= 1.7.0 imports
  • magrittr >= 2.0.0 imports
  • rlang >= 0.4.10 imports
  • stringi >= 1.5.3 imports
  • tidyr >= 1.1.1 imports
  • covr * suggests
  • testthat >= 3.0.0 suggests
.github/workflows/R-CMD-check.yaml actions
  • actions/checkout v3 composite
  • r-lib/actions/check-r-package v2 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/test-coverage.yaml actions
  • actions/checkout v3 composite
  • actions/upload-artifact v3 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite
.github/workflows/pkgdown.yaml actions
  • JamesIves/github-pages-deploy-action v4.4.1 composite
  • actions/checkout v3 composite
  • r-lib/actions/setup-pandoc v2 composite
  • r-lib/actions/setup-r v2 composite
  • r-lib/actions/setup-r-dependencies v2 composite