Please note that the column names are identical between offense/defense and you should reference the 'role' column for offensive or defensive stats.

scrape_team_stats_nfl(season = 2019, stats = "passing", role = "offense")

Arguments

season

character or numeric - greater than 1971, note that some data is missing for earlier seasons.

stats

character - either "passing", "rushing", "receiving", "scoring", "downs"

role

character - "offense" or "defense"

Value

tibble

Examples


# Get the NFL.com game-level stats for offense in 2018
scrape_team_stats_nfl(season = 2018, stats = "passing", role = "offense")
#> Scraping passing for offense from 2018!
#> # A tibble: 32 × 19
#>    season role    stat    team   pass_…¹ pass_…² pass_…³ yds_att pass_…⁴ pass_td
#>     <int> <chr>   <chr>   <chr>    <int>   <int>   <dbl>   <dbl>   <int>   <int>
#>  1   2018 OFFENSE PASSING Steel…     689     459   0.666     7.5    5174      35
#>  2   2018 OFFENSE PASSING Colts…     644     432   0.671     7.1    4595      39
#>  3   2018 OFFENSE PASSING Packe…     640     392   0.612     7.2    4629      25
#>  4   2018 OFFENSE PASSING Bucca…     625     408   0.653     8.6    5358      36
#>  5   2018 OFFENSE PASSING Falco…     617     428   0.694     8      4949      36
#>  6   2018 OFFENSE PASSING Vikin…     606     425   0.701     7.1    4298      30
#>  7   2018 OFFENSE PASSING Eagle…     599     422   0.704     7.6    4524      29
#>  8   2018 OFFENSE PASSING Bronc…     588     367   0.624     6.7    3930      19
#>  9   2018 OFFENSE PASSING Chief…     583     385   0.66      8.8    5126      50
#> 10   2018 OFFENSE PASSING Giant…     583     382   0.655     7.6    4405      23
#> # … with 22 more rows, 9 more variables: int <int>, pass_rating <dbl>,
#> #   first_downs <int>, pass_first_pct <dbl>, pass_20plus <int>,
#> #   pass_40plus <int>, pass_long <chr>, sacks <int>, sack_yds <int>, and
#> #   abbreviated variable names ¹​pass_att, ²​pass_comp, ³​pass_comp_pct, ⁴​pass_yds

# Get the NFL.com team-level passing stats for defense in 2014
scrape_team_stats_nfl(season = "2014", stats = "rushing", role = "defense")
#> Scraping rushing for defense from 2014!
#> Error in purrr::set_names(input_df, nm = clean_rush_names): The size of `nm` (11) must be compatible with the size of `x` (7).