Coder Social home page Coder Social logo

Comments (15)

mrcaseb avatar mrcaseb commented on June 18, 2024

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)

from nflreadr.

mrcaseb avatar mrcaseb commented on June 18, 2024

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

from nflreadr.

armstjc avatar armstjc commented on June 18, 2024

Yes. I was referring to depth charts.

from nflreadr.

john-b-edwards avatar john-b-edwards commented on June 18, 2024

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.

from nflreadr.

mrcaseb avatar mrcaseb commented on June 18, 2024

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)

from nflreadr.

john-b-edwards avatar john-b-edwards commented on June 18, 2024

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

from nflreadr.

john-b-edwards avatar john-b-edwards commented on June 18, 2024

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

from nflreadr.

mrcaseb avatar mrcaseb commented on June 18, 2024

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.

from nflreadr.

john-b-edwards avatar john-b-edwards commented on June 18, 2024

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

from nflreadr.

john-b-edwards avatar john-b-edwards commented on June 18, 2024

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.

from nflreadr.

mrcaseb avatar mrcaseb commented on June 18, 2024

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)

from nflreadr.

tanho63 avatar tanho63 commented on June 18, 2024

Oh lol whoops only read the PR

from nflreadr.

tanho63 avatar tanho63 commented on June 18, 2024

Happy to take further edits as necessary

from nflreadr.

john-b-edwards avatar john-b-edwards commented on June 18, 2024

@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.

from nflreadr.

mrcaseb avatar mrcaseb commented on June 18, 2024

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

from nflreadr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.