Skip to contents

Helper function to load play-by-play data from nflreadr for a specified time frame.

Usage

load_data_from_db(pbp_db, pbp_db_tbl, season, week_min, week_max)

Arguments

pbp_db_tbl

Play-by-Play database table name

season

NFL season to obtain play-by-play data. The season can be defined as a single season, season = 2024. For multiple seasons, use either season = c(2023,2024) or season = 2022:2024.

week_min

Minimum week to define whether pulling a range of weeks or the entire season. Use week_min = 1 for the first week of the season, must be an integer.

week_max

Maximum week to define a range of weeks to pull from an NFL season. If not defined, the data will be pulled for all weeks, beginning with week_min.

pbp_dp

Play-by-Play database path

Value

Dataframe containing filtered play-by-play data

Details

Helper function to load play-by-play data from from a database. The function filters the data to include a specified time frame including seasons and a range of weeks. If week_max is provided, filter between week_min and week_max If week_max is not provided, filter for weeks >= week_min to get the remainder of the season. This function is typically utilized if the user desires loading play-by-play data from a database and defined pbp_db and pbp_db_tbl as strings.

See also

update_db: Update or Create a nflfastR Play-by-Play Database

get_pbp_data: Obtain filtered play-by-play data utilizes this helper function

Author

Nolan MacDonald