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:
# Install release version from CRAN
install.packages("itscalledsoccer")
# Install development version from GitHub
::install_github("American-Soccer-Analysis/itscalledsoccer-r") devtools
Initialize the main class with the new
method.
<- AmericanSoccerAnalysis$new() asa_client
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.
<- AmericanSoccerAnalysis$new(
asa_client ::config(ssl_verifypeer = 0L),
httr::use_proxy("64.251.21.73", 8080)
httr )
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. A few
examples are below.
# Get all players named "Dax"
<- asa_client$get_players(names = "Dax")
asa_players
# Get season-by-season xG data for all players named "Dax"
<- asa_client$get_player_xgoals(
asa_xgoals leagues = "mls",
player_names = "Dax",
split_by_seasons = TRUE
)
# Get cumulative xPass data for all USL League One teams
<- asa_client$get_team_xpass(
asa_xpass leagues = "usl1"
)
# Get game-by-game goals added (g+) data for all goalkeepers named "Matt Turner"
<- asa_client$get_goalkeeper_goals_added(
asa_goals_added leagues = c("mls", "uslc"),
player_names = "Matt Turner",
split_by_game = TRUE
)