Scrape NFL weekly outcomes by week

scrape_nfl_weekly_standings(season = 2020, tidy = FALSE)

Arguments

season

character or numeric - greater than 1990

tidy

logical - either TRUE to stack data by game/week or FALSE to return table as is

Value

tibble

Examples


# Here we run w/ tidy = FALSE to get the exact table from PFR
scrape_nfl_weekly_standings(season = 2020, tidy = FALSE)
#> Scraping standings from 2020!
#> # A tibble: 269 × 16
#>    game_num season week  day   date       time   winne…¹ home_…² loser…³ pts_w…⁴
#>       <int>  <int> <chr> <chr> <chr>      <chr>  <chr>   <chr>   <chr>     <dbl>
#>  1        1   2020 1     Thu   2020-09-10 8:20PM Kansas… ""      Housto…      34
#>  2        2   2020 1     Sun   2020-09-13 1:00PM Seattl… "@"     Atlant…      38
#>  3        3   2020 1     Sun   2020-09-13 1:00PM Buffal… ""      New Yo…      27
#>  4        4   2020 1     Sun   2020-09-13 1:00PM Las Ve… "@"     Caroli…      34
#>  5        5   2020 1     Sun   2020-09-13 1:00PM Chicag… "@"     Detroi…      27
#>  6        6   2020 1     Sun   2020-09-13 1:00PM Baltim… ""      Clevel…      38
#>  7        7   2020 1     Sun   2020-09-13 1:00PM Jackso… ""      Indian…      27
#>  8        8   2020 1     Sun   2020-09-13 1:00PM Green … "@"     Minnes…      43
#>  9        9   2020 1     Sun   2020-09-13 1:00PM New En… ""      Miami …      21
#> 10       10   2020 1     Sun   2020-09-13 1:00PM Washin… ""      Philad…      27
#> # … with 259 more rows, 6 more variables: pts_loser <dbl>, yds_winner <dbl>,
#> #   turnovers_winner <dbl>, yds_loser <dbl>, turnovers_loser <dbl>,
#> #   winner <dbl>, and abbreviated variable names ¹​winner_tie, ²​home_team,
#> #   ³​loser_tie, ⁴​pts_winner

# Here we scrape the outcome and stack the games on top of eachother
scrape_nfl_weekly_standings(season = 2020, tidy = TRUE)
#> Scraping standings from 2020!
#> # A tibble: 538 × 13
#>    game_num season week  day   date     time  team  home_…¹ points yards turno…²
#>       <int>  <int> <chr> <chr> <chr>    <chr> <chr>   <dbl>  <dbl> <dbl>   <dbl>
#>  1        1   2020 1     Thu   2020-09… 8:20… Kans…       1     34   369       0
#>  2        2   2020 1     Sun   2020-09… 1:00… Seat…       0     38   383       0
#>  3        3   2020 1     Sun   2020-09… 1:00… Buff…       1     27   404       2
#>  4        4   2020 1     Sun   2020-09… 1:00… Las …       0     34   372       0
#>  5        5   2020 1     Sun   2020-09… 1:00… Chic…       0     27   363       0
#>  6        6   2020 1     Sun   2020-09… 1:00… Balt…       1     38   381       1
#>  7        7   2020 1     Sun   2020-09… 1:00… Jack…       1     27   241       0
#>  8        8   2020 1     Sun   2020-09… 1:00… Gree…       0     43   522       0
#>  9        9   2020 1     Sun   2020-09… 1:00… New …       1     21   357       1
#> 10       10   2020 1     Sun   2020-09… 1:00… Wash…       1     27   239       0
#> # … with 528 more rows, 2 more variables: winner <dbl>, playoffs <dbl>, and
#> #   abbreviated variable names ¹​home_team, ²​turnovers