sportsdataverse / cfbfastR

An R package to quickly obtain clean and tidy college football play by play data
https://cfbfastR.sportsdataverse.org
Other
74 stars 8 forks source link

cfbd_game_team_stats importing as list #64

Closed JerrickBackous closed 2 years ago

JerrickBackous commented 2 years ago

When I'm using the cfbd_game_team_stats() function, every week works except weeks 8, 11, and 12 in the 2021 season. The numeric columns are list columns during these weeks, as shown below.

image

image

Kazink36 commented 2 years ago

The error seems to stem from this pivot_wider call because the API is returning some stat categories with the same name and different numbers for a small number of names. This appears, in my opinion, to be an issue on the API's end than on ours https://github.com/saiemgilani/cfbfastR/blob/master/R/cfbd_games.R#L1343-L1346

Kazink36 commented 2 years ago

Bill re-synched the box score data that appears to have resolved the issue. I'm closing this for now. Re-open it if you still encounter any issues

data <- cfbfastR::cfbd_game_team_stats(2021, week = 8)
glimpse(data)
Rows: 108
Columns: 78
$ game_id                        <int> 401282709, 401282709, 401282111, 401282111, 4012821…
$ school                         <chr> "Notre Dame", "USC", "Tennessee", "Alabama", "South…
$ conference                     <chr> "FBS Independents", "Pac-12", "SEC", "SEC", "SEC", …
$ home_away                      <chr> "home", "away", "away", "home", "away", "home", "ho…
$ opponent                       <chr> "USC", "Notre Dame", "Alabama", "Tennessee", "Texas…
$ opponent_conference            <chr> "Pac-12", "FBS Independents", "SEC", "SEC", "SEC", …
$ points                         <int> 31, 16, 24, 52, 14, 44, 6, 45, 31, 17, 45, 3, 24, 1…
$ total_yards                    <chr> "383", "428", "347", "574", "185", "477", "155", "5…
$ net_passing_yards              <chr> "213", "299", "282", "371", "114", "187", "146", "4…
$ completion_attempts            <chr> "22-30", "27-37", "19-28", "31-43", "15-26", "12-26…
$ passing_tds                    <chr> "1", "0", "3", "2", "1", "2", "0", "5", "1", "1", "…
$ yards_per_pass                 <chr> "7.1", "8.1", "10.1", "8.6", "4.4", "7.2", "5.8", "…
$ passes_intercepted             <chr> "1", "1", NA, "1", "1", "2", "2", "1", "1", NA, "2"…
$ interception_yards             <chr> "79", "0", NA, "47", "0", "0", "0", "22", "0", NA, …