Learn R Programming

nflreadr (version 1.4.1)

get_current_week: Get Current Week

Description

A helper function that returns the upcoming NFL regular season week based on either the nflverse schedules file (as found in load_schedules()) or some date-based heuristics (number of weeks since the first Monday of September)

Usage

get_current_week(use_date = FALSE)

Value

current nfl regular season week as a numeric

Arguments

use_date

a logical to determine whether to use date-based heuristics to determine current week, default FALSE (i.e. uses schedule file)

Details

Note that the date heuristic will count a new week starting on Thursdays, while the schedule-based method will count a new week after the last game of the previous week, e.g. after MNF is completed. Tan and Ben argued for a while about this.

See Also

Other Date utils: most_recent_season()

Examples

Run this code
{
  # \donttest{
    try({ # schedules file as per default requires online access
    get_current_week()
    })
  # }
  # using the date method works offline
  get_current_week(use_date = TRUE)
}

Run the code above in your browser using DataLab