Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add documentation about season-ending depth charts to load_depth_charts data dictionary #78

Closed
armstjc opened this issue Jan 12, 2022 · 15 comments

Comments

@armstjc
Copy link

armstjc commented Jan 12, 2022

See title.
Washington Football Team Credited for a 2021 Week 19 game, despite missing the postseason

@mrcaseb
Copy link
Member

mrcaseb commented Jan 12, 2022

Are you talking about depth charts @armstjc?
This seems to be true for all 32 teams. Thoughts @john-b-edwards?

nflreadr::load_depth_charts(2021) |> 
  dplyr::filter(week == 19) |> 
  dplyr::count(team)
#> # A tibble: 32 x 2
#>    team      n
#>    <chr> <int>
#>  1 ARI      58
#>  2 ATL      53
#>  3 BAL      62
#>  4 BUF      55
#>  5 CAR      52
#>  6 CHI      55
#>  7 CIN      48
#>  8 CLE      48
#>  9 DAL      51
#> 10 DEN      57
#> # ... with 22 more rows

Created on 2022-01-12 by the reprex package (v2.0.1)

@mrcaseb
Copy link
Member

mrcaseb commented Jan 12, 2022

season_type is also listed as "REG" for week 19

nflreadr::load_depth_charts(2021) |> 
  dplyr::filter(week == 19) |> 
  dplyr::count(team, season_type)
#> # A tibble: 32 x 3
#>    team  season_type     n
#>    <chr> <chr>       <int>
#>  1 ARI   REG            58
#>  2 ATL   REG            53
#>  3 BAL   REG            62
#>  4 BUF   REG            55
#>  5 CAR   REG            52
#>  6 CHI   REG            55
#>  7 CIN   REG            48
#>  8 CLE   REG            48
#>  9 DAL   REG            51
#> 10 DEN   REG            57
#> # ... with 22 more rows

@armstjc
Copy link
Author

armstjc commented Jan 12, 2022

Yes. I was referring to depth charts.

@john-b-edwards
Copy link
Contributor

There appears to be a week 19 for all teams' depth charts from the NFL API. There is also a week 18 listed for the 2020 regular season (which was a 17 week season) and I presume other seasons as well. My best guess is that this is some sort of end-of-season depth chart -- i.e. John Bates is listed as TE1 for the WFT for Week 19, 2021 instead of Ricky Seals-Jones -- Seals-Jones was inactive for week 18 and Bates was on the field for 100% of snaps Week 18.

I think we should make a note of this in the {nflreadr} documentation but otherwise not change the code.

@tanho63 tanho63 changed the title Jan 12, 2022
@tanho63 tanho63 transferred this issue from nflverse/nflverse-rosters Jan 12, 2022
@mrcaseb
Copy link
Member

mrcaseb commented Jan 12, 2022

There appears to be a week 19 for all teams' depth charts from the NFL API. There is also a week 18 listed for the 2020 regular season (which was a 17 week season) and I presume other seasons as well. My best guess is that this is some sort of end-of-season depth chart -- i.e. John Bates is listed as TE1 for the WFT for Week 19, 2021 instead of Ricky Seals-Jones -- Seals-Jones was inactive for week 18 and Bates was on the field for 100% of snaps Week 18.

I think we should make a note of this in the {nflreadr} documentation but otherwise not change the code.

I don't have a reprex currently but checked Number of teams in week 19 for all seasons and it was a bit weird.

  • > 30 for the seasons 2001:2003
  • 12 for the seasons 2004:2019
  • 32 for 2020 and 2021
    (or something close to that)

@john-b-edwards
Copy link
Contributor

... also odd. I only checked 2020 and 2021

@john-b-edwards
Copy link
Contributor

john-b-edwards commented Jan 12, 2022

To be clear you're referencing week 18* for 2020 right? @mrcaseb

@mrcaseb
Copy link
Member

mrcaseb commented Jan 12, 2022

To be clear you're referencing week 18* for 2020 right? @mrcaseb

No I don't. That's the fun thing. I did week 19 because of laziness. Changed it afterwards to season_type == "REG" which removed 2021 completely of course but kept the higher numbers for the earlier seasons.

@john-b-edwards
Copy link
Contributor

... okay, gonna revert my PR then until we figure out what's going on.

@john-b-edwards
Copy link
Contributor

john-b-edwards commented Jan 12, 2022

I only see 12* teams for 2020, and they're listed as postseason teams.

nflreadr::load_depth_charts(2020) |>
    dplyr::filter(week == 19)
#> # A tibble: 733 x 13
#>    season  week team  season_type position depth_chart_pos~ formation depth_team
#>     <int> <int> <chr> <chr>       <chr>    <chr>            <chr>          <int>
#>  1   2020    19 BUF   POST        OLB      WLB              Defense            2
#>  2   2020    19 BUF   POST        CB       NCB              Defense            1
#>  3   2020    19 BUF   POST        SS       S                Defense            1
#>  4   2020    19 BUF   POST        FS       S                Defense            1
#>  5   2020    19 BUF   POST        WR       PR               Special ~          2
#>  6   2020    19 BUF   POST        WR       KOR              Special ~          2
#>  7   2020    19 BUF   POST        T        LT               Offense            1
#>  8   2020    19 BUF   POST        G        LG               Offense            2
#>  9   2020    19 BUF   POST        C        C                Offense            1
#> 10   2020    19 BUF   POST        G        RG               Offense            2
#> # ... with 723 more rows, and 5 more variables: jersey_number <int>,
#> #   full_name <chr>, first_name <chr>, last_name <chr>, gsis_id <chr>
nflreadr::load_depth_charts(2020) |>
    dplyr::filter(week == 19) |>
    dplyr::pull(team) |>
    unique()
#>  [1] "BUF" "CHI" "BAL" "TEN" "IND" "LA"  "NO"  "PIT" "SEA" "TB"  "WAS" "CLE"

Meanwhile week 18 for 2020 has 32 teams with season_type = 'REG'.

I think my original intuition was correct, such that:

  • Weeks 1-17/18 represent the depth charts for each game of the regular season.
  • Week 18/19 represents an end-of-season depth chart for all regular season teams
  • Week 19/20 represents the depth charts for the teams in the first week of the postseason.

Can probably clarify this further in the data dict.

@mrcaseb
Copy link
Member

mrcaseb commented Jan 12, 2022

I wrote some code to look at this and I think its a bit inconsistent

  • week 18 is missing for <2006
  • postseason is missing for 2005
  • SB is week 22 for 2004, 2006, 2014
  • week 20 mostly > week 19
library(dplyr, warn.conflicts = FALSE)
library(ggplot2)

df <- nflreadr::load_depth_charts(TRUE)

df |> 
  group_by(season, week, team) |> 
  summarise() |> 
  ungroup() |> 
  count(season, week) |> 
  mutate(alpha = ifelse(n == 32, 0.2, 1)) |> 
  ggplot(aes(x = season, y = week)) +
  geom_text(aes(label = n, alpha = alpha), size = 3) +
  scale_alpha_identity() +
  scale_y_continuous(breaks = scales::breaks_pretty(n = 10)) +
  theme_minimal()
#> `summarise()` has grouped output by 'season', 'week'. You can override using the `.groups` argument.

Created on 2022-01-12 by the reprex package (v2.0.1)

@tanho63
Copy link
Member

tanho63 commented Jan 12, 2022

Oh lol whoops only read the PR

@tanho63 tanho63 reopened this Jan 12, 2022
@tanho63
Copy link
Member

tanho63 commented Jan 12, 2022

Happy to take further edits as necessary

@john-b-edwards
Copy link
Contributor

john-b-edwards commented Jan 12, 2022

@mrcaseb great stuff, that really clarifies it. So my above comment holds true but only for 2007-2013, and 2015-2021. Seems like it may involve some data munging to get this into something resembling a consistent format?

My thought is:

  • Drop end of season DC
  • Re-order playoff DC such that WC week is week 1 instead of 19/20

Curious if anyone feels differently?

Can get to this later today after work.

@mrcaseb
Copy link
Member

mrcaseb commented Jan 12, 2022

I think we should discuss this in a separate nflfastr-roster issue as the code that creates this lives there. The SB week issue is based on the fact that the max regular season week in these seasons is 17 compared to 18 in the other seasons. I will open a new issue with the above code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants