knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
The goal of rusfl is to provide functions to load and parse USFL data.
You can install the development version of rusfl from GitHub with:
# install.packages("devtools") devtools::install_github("mrcaseb/rusfl")
This USFL api requires an api key that is not provided with this package.
This will be loaded from Anthony Reinhard's Github.
teams <- rusfl::usfl_load_teams() dplyr::glimpse(teams)
The best way is to use the wrapper rusfl::usfl_load_scores()
and choose the weeks.
games <- rusfl::usfl_load_scores(1:2) dplyr::glimpse(games)
The best way is to use the wrapper rusfl::usfl_load_rosters()
and choose the teams. The default loads all teams.
roster <- rusfl::usfl_load_rosters() roster
Boxscores and Play by Play will be extracted from raw game data. So we have to load the raw game data first. The game ids are included in games
. In this example these are
cli::cli_text("{games$id}")
Let's load usfl3
raw <- rusfl::usfl_load_game_data("usfl3")
This will be a list of deeply nested lists. The structure is
str(raw, max.level = 2)
Play by Play can be parsed with
pbp <- rusfl::usfl_parse_pbp(raw) dplyr::glimpse(pbp)
Boxscore data can be parsed on the player level or on the team level.
Team level will look like this
rusfl::usfl_parse_boxscores(raw, "teams")
and player level will look like this
player_stats <- rusfl::usfl_parse_boxscores(raw) dplyr::glimpse(player_stats)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.