knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)

rusfl

The goal of rusfl is to provide functions to load and parse USFL data.

Installation

You can install the development version of rusfl from GitHub with:

# install.packages("devtools")
devtools::install_github("mrcaseb/rusfl")

NOTE

This USFL api requires an api key that is not provided with this package.

Examples

Load Basic Team Info

This will be loaded from Anthony Reinhard's Github.

teams <- rusfl::usfl_load_teams()
dplyr::glimpse(teams)

Load Game Info for multiple Weeks

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)

Load Rosters

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

Load Raw Game Data

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)


mrcaseb/rusfl documentation built on April 29, 2022, 7:20 p.m.