Coder Social home page Coder Social logo

sportsdataverse / cfbfastr Goto Github PK

View Code? Open in Web Editor NEW
68.0 8.0 8.0 94.73 MB

An R package to quickly obtain clean and tidy college football play by play data

Home Page: https://cfbfastR.sportsdataverse.org

License: Other

R 99.26% CSS 0.74%
sports sports-data sports-stats sports-analytics sportsanalytics football football-data football-api football-scores sports-betting

cfbfastr's Introduction

cfbfastR

CRAN version CRAN downloads Version-Number R-CMD-check Lifecycle:maturing Contributors Twitter Follow Twitter Follow

The goal of cfbfastR is to provide the community with an R package for working with CFB data. It is an R API wrapper around https://collegefootballdata.com/. Beyond data aggregation and tidying ease, one of the multitude of services that cfbfastR provides is for benchmarking open-source expected points and win probability metrics.

Installation

You can install the CRAN version of cfbfastR with:

install.packages("cfbfastR")

You can install the released version of cfbfastR from GitHub with:

# You can install using the pacman package using the following code:
if (!requireNamespace('pacman', quietly = TRUE)){
  install.packages('pacman')
}
pacman::p_load_current_gh("sportsdataverse/cfbfastR", dependencies = TRUE, update = TRUE)

Breaking Changes

Full News on Releases

College Football Data API Keys

The CollegeFootballData API now requires an API key, here’s a quick run-down:

CFBD_API_KEY = YOUR-API-KEY-HERE

Save the script and restart your RStudio session, by clicking Session (in between Plots and Build) and click Restart R (there also exists the shortcut Ctrl + Shift + F10 to restart your session). If set correctly, from then on you should be able to use any of the cfbd_ functions without any other changes.

  • For less consistent usage: At the beginning of every session or within an R environment, save your API key as the environment variable CFBD_API_KEY (with quotations) using a command like the following.
Sys.setenv(CFBD_API_KEY = "YOUR-API-KEY-HERE")

Follow cfbfastR and the SportsDataverse on Twitter and star this repo

Twitter Follow Twitter Follow

GitHub stars

Our Authors

Our Contributors (they’re awesome)

Authors Emeritus - cfbscrapR[archived]

Special Thanks

Citations

To cite the cfbfastR R package in publications, use:

BibTex Citation

@misc{gilani_et_al_2021_cfbfastr,
  author = {Saiem Gilani and Akshay Easwaran and Jared Lee and Eric Hess},
  title = {cfbfastR: The SportsDataverse's R Package for College Football Data.},
  url = {https://cfbfastR.sportsdataverse.org/},
  year = {2021}
}

cfbfastr's People

Contributors

akeaswaran avatar kazink36 avatar keegan-abdoo avatar maatspencer avatar mcqconor avatar mrcaseb avatar saiemgilani avatar tanho63 avatar topfunky avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cfbfastr's Issues

cfbd_play_types is documented, but isn't in the package

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

`espn_ratings_fpi` not in CRAN install

Describe the bug
espn_ratings_fpi not in CRAN install

To Reproduce

install.packages("cfbfastR")
library(cfbfastR)
cfbfastR::espn_ratings_fpi(year = 2018)

Expected behavior
For this function to be available
https://saiemgilani.github.io/cfbfastR/reference/espn_ratings.html

Screenshots
If applicable, add screenshots to help explain your problem.
image

Desktop (please complete the following information):

R version 4.1.1 (2021-08-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19041)

other attached packages:
[1] cfbfastR_1.6.4

Play by play for data 2013 and before

Describe the bug
When using the cfbd_pbp_data for any data before 2014, I am getting errors.

When running the following:
Input:
tmp <- tibble()
wk <- 3
seas <- "regular"
yr <- 2013
tmp <- cfbd_pbp_data(yr, seas, wk, team = NULL, play_type = NULL, epa_wpa = TRUE), it returns the following error:

Error:
Error in predict.nnet(object, X) : missing values in 'x'
In addition: Warning messages:
1: In log(dat$new_distance[neg_distance]) : NaNs produced
2: In log(dat$new_distance[neg_distance]) : NaNs produced
3: In log(dat$new_distance[neg_distance]) : NaNs produced
4: In log(dat$new_distance[neg_distance]) : NaNs produced
5: In log(dat$new_distance[neg_distance]) : NaNs produced
6: In log(dat$new_distance[neg_distance]) : NaNs produced

Sometimes another error is produced:
Input:
tmp <- tibble()
wk <- 1
seas <- "regular"
yr <- 2012
tmp <- cfbd_pbp_data(yr, seas, wk, team = NULL, play_type = NULL, epa_wpa = TRUE)

Error:
Error in predict.nnet(object, X) : missing values in 'x'
In addition: There were 20 warnings (use warnings() to see them)

Incorrect values recorded for drive points

cfbfastR::cfbd_pbp_data() reports erroneous values for the number of points scored on a drive for some plays. For example:

cfbfastR::cfbd_pbp_data(year = 2021, season_type = "regular", week = 3) |>
  dplyr::filter(play_type == "Defensive 2pt Conversion") |>
  dplyr::pull(drive_pts)
#> [1] 7

I have a dataframe of all plays loaded in my local environment and the only possible values for drive_pts appear to be -7, -2, 0, 3, or 7 -- impossible given 1) missed extra points resulting in -6 and 6, 2) successful and missed two-point conversions resulting in -8, -6, 6, or 8, and 3) defensive 2 point and 1 point conversions, resulting in -5, -4, 4, and 5. Some of these possibilities are too rare to have occurred in the dataset, but others -- like 8 -- should be present in the dataframe but are not.

Precalculate cfbd_pbp_data epa/wpa values to speed up data loading

Is your feature request related to a problem? Please describe.
Today when I want epa or wpa data, I call cfbd_pbp_data for each week, sometimes going back several seasons. For each week, epa/wpa numbers are calculated by the function call, taking a minute or more per week.

Describe the solution you'd like
Precalculate the epa/wpa numbers and store them with the base data coming from the API. So when I call cfbd_pbp_data it only takes a few seconds to download the data from the API.

Describe alternatives you've considered
N/A

Additional context
nflfastr precalculates epa/wpa numbers which makes it quicker to get historical data.

Change object returned for empty cfbd_stats_game_advanced response

When you call cfbd_stats_game_advanced() with a valid value but receive an empty response (e.g., no games yet for 2023), the return value is an empty list. A valid response to the cfbd_stats_game_advanced returns a cfbfastR_data object. For example:

tibble(year = 2021:2023) %>%
  mutate(stats = map(year, ~ cfbd_stats_game_advanced(year = .x, season_type = "both")))
2023-04-08 12:49:21:Invalid arguments or no game advanced stats data available!
# A tibble: 3 × 2
   year stats                  
  <int> <list>                 
1  2021 <cfbfstR_ [1,692 × 60]>
2  2022 <cfbfstR_ [2,842 × 60]>
3  2023 <list [0]>   

This function does throw a warning -- but in returning objects of different types, it can cause errors in downstream processing that expects objects of the same type. For example, trying to unnest the result above generates a type conflict error:

> tibble(year = 2021:2023) %>%
+     mutate(stats = map(year, ~ cfbd_stats_game_advanced(year = .x, season_type = "both"))) %>%
+     unnest(stats)
2023-04-08 12:52:50:Invalid arguments or no game advanced stats data available!
Error in `list_unchop()`:
! Can't combine `x[[1]]` <tbl_df> and `x[[3]]` <list>.

Expected behavior
The function should either throw an error when no stats are available, or it should return the same object type as a non-empty response (i.e., cfbfastR_data). I suggest returning an empty cfbfastR_data object -- a well-formed query about a valid year (e.g., the current year) in which no games happen to have been played yet should be empty, not an error. In the example above, the correct response gets returned (stats for games in two of the three seasons specified, and none for the last) but the object type conflict prevents their combination in later processing. Expected behavior would look something like this:

tibble(year = 2021:2023) %>%
  mutate(stats = map(year, ~ cfbd_stats_game_advanced(year = .x, season_type = "both")))
2023-04-08 12:49:21: Invalid arguments or no game advanced stats data available!
# A tibble: 3 × 2
   year stats                  
  <int> <list>                 
1  2021 <cfbfstR_ [1,692 × 60]>
2  2022 <cfbfstR_ [2,842 × 60]>
3  2023 <cfbfstR_ [0 × 60]>   

```cfbd_team_info``` has ```year``` as parameter but real CFBD API endpoint does not

The cfbd_team_info function in cfbd_teams.R receives conference, only_fbs, and year as arguments. However, only conference and only_fbs work. year is not a query parameter according to CFBDATA. As such, this ends up not doing anything when trying to filter for different years. This can be misleading and does not actually have any functionality.

To Reproduce
Call cfbfastR::cfbd_team_info(year=2019) and cfbfastR::cfbd_team_info(year=2023) and view results. They will be the same.

Expected behavior
The call with year=2019 should give a list of teams that are active in 2019, and the call with year=2023 should give a list of teams that are active in 2023.

Screenshots
Screenshot 2024-01-27 at 3 54 42 PM
Screenshot 2024-01-27 at 3 54 27 PM

The first screenshot shows the swaggerUI docs for the CFBDATA API. As seen, there is no query parameter for year, only conference.

The second screenshot shows the source code for the teams endpoint in the cfbdata codebase. There is no filter for year, only for conference. This can be seen here https://github.com/CFBD/cfb-api/blob/main/app/team/team.controller.js

espn_ratings_fpi not found

Describe the bug
R Studio cannot find the espn_ratings_fpi function even when cfbfastR is loaded.

To Reproduce
Steps to reproduce the behavior:

  1. install and load the cfbfastR library
  2. try to call espn_ratings_fpi(year = x)
  3. See error - Error in espn_ratings_fpi(year = 2019) :
    could not find function "espn_ratings_fpi"

Expected behavior
Return a dataframe with the specified columns

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

cfbd_pbp_data process

Using purrr methods, when year and week are iterated over, due to the saving of the parameters also as column names within the data process, causes renaming issues. Suggest switching year to season and week to wk (or something better)

> pacman::p_load_current_gh("saiemgilani/cfbfastR")
> pacman::p_load(tidyverse, zoo, ggimage, gt)
> library(dplyr)
> library(tidyr)
> library(purrr)
> # Play-by-Play Data Pull --------------------------------------------------
> week_vector <- 1:15
> year_vector <- 2019
> weekly_year_df <- expand.grid(year = year_vector, week = week_vector)
> ### scrape yearly
> year_split <- split(weekly_year_df, weekly_year_df$year)
> 
> ### starting time
> tictoc::tic()
> 
> for (i in 1:length(year_split)) {
+   i <- 1
+   print(paste0("Working on ", year_split[[i]][1, 1]))
+   future::plan("multisession")
+   progressr::with_progress({
+     year_split[[i]] <- year_split[[i]] %>%
+       dplyr::mutate(
+         pbp = purrr::map2(
+           .x = year,
+           .y = week,
+           cfbd_pbp_data,
+           season_type = "both",
+           epa_wpa = TRUE
+         )
+       )
+   })
+ }
[1] "Working on 2019"
* Start processing of 125 games...
* Start processing of 74 games...                
* Start processing of 68 games...                
* Start processing of 57 games...                
* Start processing of 55 games...                
* Start processing of 48 games...                
* Start processing of 53 games...                
* Start processing of 62 games...                
* Start processing of 55 games...                
* Start processing of 48 games...                
* Start processing of 48 games...                
* Start processing of 55 games...                
* Start processing of 64 games...                
* Start processing of 64 games...                
* Start processing of 11 games...                
                                                 
> 
> tictoc::toc()
417.23 sec elapsed
> ## (~6-7 minutes)
> year_split <- lapply(year_split, function(x) {
+   x %>% tidyr::unnest(pbp, names_repair = "minimal")
+ })
> 
> all_years <- dplyr::bind_rows(year_split)
New names:
* year -> year...1
* week -> week...2
* year -> year...3
* week -> week...4

Getting CFB team logos without cfbplotR package

To my knowledge, the geom_cfb_logos package used to only be available in the cfbplotR package (see this post for more: https://kazink36.github.io/cfbplotR/reference/geom_cfb_logos.html). However, I recently upgraded my RStudio to Version 2023.12.1+402, which was released on 1/29/2024 (https://posit.co/download/rstudio-desktop/).

Now, when I attempt to run install.packages("cfbplotR"), I see the following:

Warning in install.packages :
package ‘cfbplotR’ is not available for this version of R

As a result, if I wanted to incorporate college football team logos into a ggplot, is it necessary to uninstall this most recent version of RStudio? Or is there another package, whether that means cfbfastR or something else, that allows us to do the trick?

Thanks in advance for any assistance, and thanks to the cfbfastR team's hard work in general for helping out the football analytics community so thoroughly.

Add Valid year ranges to the docs

On functions where year is a parameter please add the minimum integer where the endpoint will work. This number varies across endpoints

update_cfb_db issue

It looks like an update to the data repo on April 18th dropped the "season" column in the games_in_data_repo.csv that is called in the load_games function. Subsequently, this is causing issues in the update_cfb_db function.

Error:

Error: Problem with `filter()` input `..1`.
Input `..1` is `.data$season >= 2014`.
Column `season` not found in `.data`

cfbd_game_player_stats columns are lists instead of numeric

Describe the bug
When using the cfbd_game_player_stats() function the stat columns should be numeric and the data should be wide, referenced here https://cfbfastr.sportsdataverse.org/reference/cfbd_game_player_stats.html, but the columns import as lists and the category column is still present.

To Reproduce
Run the following code: cfbd_game_player_stats(2013, week = 1, team = "Florida State", category = "passing")

Expected behavior
The data is wider and the stat columns are numeric instead of lists.
image

Screenshots
I used the vignette examples to show the actual output below:
image
image

Desktop (please complete the following information):

  • OS: Windows 11

cfbd_player_usage(2022,NULL,NULL,NULL,player_id,FALSE)

Describe the bug
cfbd_player_usage() when passing an athlete_id number and year to this function it returns all players from that year.
If passing it the Team identifier along with athlete_id, it returns all players from that team. So it seems the team is being handled correctly but its essentially ignoring the athlete_id variable that's being passed.

To Reproduce
Steps to reproduce the behavior:

  1. cfbd_player_usage(2022, "Clemson", NULL, NULL, 4430518, FALSE)

Expected behavior

1 2022 4430518 Brannon S~ WR Clem~ ACC 0.0265 0.055 0 0.0281 0.028 0.022 0.024 0.025

Actual Behavior

1 2022 4429020 D.J. Uia~ QB Clem~ ACC 0.571 0.922 0.245 0.537 0.507 0.748 0.458 0.697
2 2022 4431545 Will Shi~ RB Clem~ ACC 0.250 0.0906 0.399 0.302 0.227 0.178 0.301 0.134
3 2022 4431562 Phil Maf~ RB Clem~ ACC 0.117 0.0291 0.199 0.119 0.161 0.037 0.12 0.109
4 2022 5081432 Antonio ~ WR Clem~ ACC 0.0655 0.123 0.0121 0.0632 0.057 0.081 0.048 0.08
5 2022 4426426 Joseph N~ WR Clem~ ACC 0.0577 0.120 0 0.0667 0.047 0.059 0.036 0.065
6 2022 4685413 Cade Klu~ QB Clem~ ACC 0.0499 0.0712 0.0302 0.0281 0.066 0.074 0.072 0.06
7 2022 4426553 Davis Al~ TE Clem~ ACC 0.0499 0.104 0 0.0561 0.024 0.081 0.018 0.065
8 2022 4431210 Beaux Co~ WR Clem~ ACC 0.0468 0.0971 0 0.0281 0.052 0.074 0.036 0.08
9 2022 4686095 Kobe Pace RB Clem~ ACC 0.0421 0.0227 0.0604 0.0421 0.052 0.03 0.042 0.045
10 2022 4431196 Jake Bri~ TE Clem~ ACC 0.0281 0.0583 0 0.0281 0.024 0.037 0.024 0.03

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser; N/A
  • vRStudio 2022.07.1+554

Smartphone (please complete the following information):
N/A

Additional context
Add any other context about the problem here.

cfbd_game_team_stats importing as list

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

cfbd_game_player_stats

cfbd_game_player_stats was silently erroring on a conversion to numeric near the end of the unpacking. Preparing a hotfix, but will need to take a second look at fully unpacking the list cols and converting to numeric in a more robust manner

cfbd_betting_lines

In cfbfastR_1.9.0 it only loads certain years of betting data, for example, 2019-2022 but not 2023. However when cross-referenced with the cfbdata website, the betting data can be found there. I also attempted running the code while directly referencing the package (cfbfastR::), as per a previous closed bug report, but to no avail.

To Reproduce

  1. bet_data <- cfbd_betting_lines(year = 2023)
  2. also attempted: bet_i <- cfbfastR::cfbd_betting_lines(year = i)
  3. Error: 2023-11-07 20:13:31: Invalid arguments or no betting lines data available!

Expected behavior
Should return my dataset named bet_data containing the betting lines data frame

Desktop (please complete the following information):

  • OS: iOS
  • Browser: Chrome

Inconsistent formatting of data returned by `cfbd_game_team_stats()`

When calling cfbfastR::cfbd_game_team_stats(), some season/week/season type combinations return long data, others return wide data.

cfbfastR::cfbd_game_team_stats(2004, 1, "regular")
#> ── Team stats data from CollegeFootballData.com ────────────── cfbfastR 1.9.0 ──
#> ℹ Data updated: 2022-07-23 17:17:58 PDT
#> # A tibble: 4 × 78
#>    game_id school confe…¹ home_…² oppon…³ oppon…⁴ points total…⁵ net_p…⁶ compl…⁷
#>      <int> <chr>  <chr>   <chr>   <chr>   <chr>    <int> <chr>   <chr>   <chr>  
#> 1   2.42e8 Virgi… ACC     home    USC     Pac-10      13 294     180     14-29  
#> 2   2.42e8 USC    Pac-10  away    Virgin… ACC         24 373     284     19-29  
#> 3   2.42e8 India… MVFC    away    Miami … Mid-Am…      0 204     137     18-33  
#> 4   2.42e8 Miami… Mid-Am… home    Indian… MVFC        49 454     292     24-37  
#> # … with 68 more variables: passing_tds <chr>, yards_per_pass <chr>,
#> #   passes_intercepted <chr>, interception_yards <chr>, interception_tds <chr>,
#> #   rushing_attempts <chr>, rushing_yards <chr>, rush_tds <chr>,
#> #   yards_per_rush_attempt <chr>, first_downs <chr>, third_down_eff <chr>,
#> #   fourth_down_eff <chr>, punt_returns <chr>, punt_return_yards <chr>,
#> #   punt_return_tds <chr>, kick_return_yards <lgl>, kick_return_tds <lgl>,
#> #   kick_returns <lgl>, kicking_points <chr>, fumbles_recovered <chr>, …
#> # ℹ Use `colnames()` to see all variable names
cfbfastR::cfbd_game_team_stats(2004, 2, "regular")
#> # A tibble: 2,840 × 7
#>           id school conference homeAway points category           stat 
#>        <int> <chr>  <chr>      <chr>     <int> <chr>              <chr>
#>  1 242482426 Duke   ACC        away         12 fumblesRecovered   3    
#>  2 242482426 Duke   ACC        away         12 rushingTDs         1    
#>  3 242482426 Duke   ACC        away         12 passingTDs         0    
#>  4 242482426 Duke   ACC        away         12 kickingPoints      6    
#>  5 242482426 Duke   ACC        away         12 firstDowns         14   
#>  6 242482426 Duke   ACC        away         12 thirdDownEff       2-13 
#>  7 242482426 Duke   ACC        away         12 fourthDownEff      1-2  
#>  8 242482426 Duke   ACC        away         12 totalYards         265  
#>  9 242482426 Duke   ACC        away         12 netPassingYards    115  
#> 10 242482426 Duke   ACC        away         12 completionAttempts 13-22
#> # … with 2,830 more rows
#> # ℹ Use `print(n = ...)` to see more rows
sessionInfo()
#> R version 4.2.1 (2022-06-23 ucrt)
#> Platform: x86_64-w64-mingw32/x64 (64-bit)
#> Running under: Windows 10 x64 (build 22000)
#> 
#> Matrix products: default
#> 
#> locale:
#> [1] LC_COLLATE=English_United States.utf8 
#> [2] LC_CTYPE=English_United States.utf8   
#> [3] LC_MONETARY=English_United States.utf8
#> [4] LC_NUMERIC=C                          
#> [5] LC_TIME=English_United States.utf8    
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> loaded via a namespace (and not attached):
#>  [1] Rcpp_1.0.9         pillar_1.8.0       compiler_4.2.1     highr_0.9         
#>  [5] tools_4.2.1        digest_0.6.29      lattice_0.20-45    nlme_3.1-157      
#>  [9] jsonlite_1.8.0     lubridate_1.8.0    evaluate_0.15      lifecycle_1.0.1   
#> [13] tibble_3.1.7       mgcv_1.8-40        pkgconfig_2.0.3    rlang_1.0.4       
#> [17] Matrix_1.4-1       reprex_2.0.1       cli_3.3.0          DBI_1.1.3         
#> [21] rstudioapi_0.13    curl_4.3.2         yaml_2.3.5         xfun_0.31         
#> [25] fastmap_1.1.0      janitor_2.1.0      httr_1.4.3         cfbfastR_1.9.0    
#> [29] withr_2.5.0        dplyr_1.0.9        stringr_1.4.0      knitr_1.39        
#> [33] generics_0.1.3     fs_1.5.2           vctrs_0.4.1        nnet_7.3-17       
#> [37] grid_4.2.1         tidyselect_1.1.2   snakecase_0.11.0   glue_1.6.2        
#> [41] data.table_1.14.2  R6_2.5.1           fansi_1.0.3        rmarkdown_2.14    
#> [45] purrr_0.3.4        tidyr_1.2.0        magrittr_2.0.3     splines_4.2.1     
#> [49] htmltools_0.5.3    ellipsis_0.3.2     assertthat_0.2.1   utf8_1.2.2        
#> [53] stringi_1.7.8      RcppParallel_5.1.5

cfpd_pbp_data cannot load 2021 week 12 pbp data

Describe the bug
When trying to scrape play by play data for week 12 in 2021, the method cfpd_pbp_data throws an error Error in model.frame.default(Terms, newdata, na.action = na.omit, xlev = object$xlevels) : factor down has new levels 5 and does not return any data. It seems that there may be a misinput in the source data.

To Reproduce
Steps to reproduce the behavior:
call cfb_df = cfbd_pbp_data(2021, week=12, season_type="both", epa_wpa=TRUE)

Expected behavior
I expected to get the pbp dataframe. It would be nice to be notified if there are any datapoints that seem wrong (like down=5) so I can remove them, but this is not something that is super important to me.

Screenshots
image

Desktop (please complete the following information):

  • OS: Windows
  • RStudio

EPA on Punt plays looks broken

Describe the bug
The EPA on punt plays does not seem to be factoring correctly.

To Reproduce

  1. Go to the play by play data
  2. Filter play_type == "Punt"
  3. Observe how many punt plays include very large EPA numbers for the defensive team on uneventful plays

Expected behavior
For punt plays that net out to around 40 yards, the EPA should be minimal.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Request Failed [500] -> 2021 Data

I have been using cfbfastR for the past couple of weeks and have loaded data from 2015 to 2021. Today however I have been unable to load 2021 data and I believe you should look into this.

cfbd_game_team_stats is requiring the "team" argument.

The cfbd_game_team_stats is requiring the "team" argument. However, the arguments description state that it is optional.

Expected behavior

I should be able to execute cfbd_game_team_stats with a minimum of the "year" argument as documented in the usage file.
https://cfbfastr.sportsdataverse.org/reference/cfbd_game_team_stats.html

team
(String optional): D-I Team

Screenshots of Error

Error returned from R Studio.

df <- cfbd_game_team_stats(2021)
Request failed [400]. Retrying in 1.1 seconds...
Request failed [400]. Retrying in 1.3 seconds...
2022-11-15 17:43:42: Invalid arguments or no team stats data available!

Desktop (please complete the following information):

  • Windows 10 ver. 21H2
  • R Studio version 2022.07.2 Build 576

R: cfbd_game_player_stats giving 400 error

Describe the bug
cfbd_game_player_stats giving 400 error. No other cfbd function is throwing said error.

To Reproduce
Steps to reproduce the behavior:
In R
install.packages('cfbfastR')
library(cfbfastR)
cfbd_game_player_stats(2021)

Expected behavior
Expect to load a dataframe.

Screenshots
R_Error

Desktop (please complete the following information):

  • OS: Windows
  • RStudio: 2022.07.01
  • R: 4.2.1

cfbd_game_weather

Describe the bug
When using the cfbd_game_weather function I keep getting a 401 Error code. I have tried changing my input and have restarted my computer and attempted to do the function with different internet connections to no avail. All other of my functions seem to be working fine. My CFBFastR is up to date.

To Reproduce
Steps to reproduce the behavior:

  • Input values for cfbd_game_weather function and run code

Expected behavior
I expected a data frame with data from the function

Screenshots
image

Desktop (please complete the following information):

  • OS- Windows
  • Browser: Microsoft Edge

Smartphone (please complete the following information):

  • NA

Additional context

I am relatively new to RStudio and CFBFastR, so it is likely that I am making a dumb mistake, however, I am unable to figure out what.

team_id

In order to avoid data mixup's please add the team_id from the cfbd_team_info endpoint to all other endpoints where team/school is only included by chr()

Can't load betting lines

Describe the bug
Using cfbfastR v1.6.4, I can't load in any betting lines data. It might be that I have a deprecated version, but I have not been able to update by any means.

To Reproduce
cfbd_betting_lines(year = 2020)
2022-04-09 11:41:21: Invalid arguments or no betting lines data available!

Expected behavior
Betting lines from 2020 should be loaded

CFBD Functions Return curl_fetch_memory error

All "cfbd_" functions return the following error:

team_info <- cfbd_team_info(year = 2021)

Error in curl::curl_fetch_memory(url, handle = handle): SSL certificate problem: certificate has expired
Request failed [ERROR]. Retrying in 1 seconds...

cfb_pbp_data() only returning 56 variables

I was reading over the documentation for the cfb_pbp_data() function and noticed that it's supposed to return 351 variables. However, upon using it, I only obtain 56 columns for the year 2023 (additional testing in prior years 2020 and 2018 provided the same result.)

I am using:

  • cfbfastR version 1.9.0
  • R version 4.3.1

Screenshot of using glimpse() on the 2023 cfb_pbp_data() data.

cfbd_pbp_data_load

I apologize if this is the result of me missing an argument somewhere! Thank you!

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.