From d5d66cf394a2db9a9e0a5fe1428bd9d2473cbe49 Mon Sep 17 00:00:00 2001 From: Saiem Gilani Date: Thu, 22 Apr 2021 17:54:04 -0400 Subject: [PATCH] cfbd_metrics_ppa_players_season.R move `id` to `athlete_id` --- NEWS.md | 4 ++ README.Rmd | 3 +- .../test-cfbd_metrics_ppa_players_season.R | 46 +++++++++---------- 3 files changed, 29 insertions(+), 24 deletions(-) diff --git a/NEWS.md b/NEWS.md index 5622ae7c..3944e10c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -12,8 +12,12 @@ - [```cfbd_teams```](https://saiemgilani.github.io/cfbfastR/articles/cfbd_teams.html) * [Introductory vignette stub](https://saiemgilani.github.io/cfbfastR/articles/intro.html) added + +#### **ESPN/CFBD metrics function variable return standardization** + * Change `id` variable to `team_id` in [```espn_ratings_fpi()```](https://saiemgilani.github.io/cfbfastR/reference/espn_ratings.html) * Changed `espn_game_id` variable to `game_id` in [```espn_metrics_wp()```](https://saiemgilani.github.io/cfbfastR/reference/espn_metrics.html), corrected the `away_win_percentage` calculation and added `tie_percentage` to the returns. +* Change `id` variable to `athlete_id` in [```cfbd_metrics_ppa_players_season()```](https://saiemgilani.github.io/cfbfastR/reference/cfbd_metrics.html) ### **v1.1.0** #### **Add loading from Data Repository functionality** diff --git a/README.Rmd b/README.Rmd index 727800f1..2b43a428 100644 --- a/README.Rmd +++ b/README.Rmd @@ -86,10 +86,11 @@ devtools::install_github(repo = "saiemgilani/cfbfastR") * [Introductory vignette stub](https://saiemgilani.github.io/cfbfastR/articles/intro.html) added -#### **ESPN function variable standardization** +#### **ESPN/CFBD metrics function variable return standardization** * Change `id` variable to `team_id` in [```espn_ratings_fpi()```](https://saiemgilani.github.io/cfbfastR/reference/espn_ratings.html) * Changed `espn_game_id` variable to `game_id` in [```espn_metrics_wp()```](https://saiemgilani.github.io/cfbfastR/reference/espn_metrics.html), corrected the `away_win_percentage` calculation and added `tie_percentage` to the returns. +* Change `id` variable to `athlete_id` in [```cfbd_metrics_ppa_players_season()```](https://saiemgilani.github.io/cfbfastR/reference/cfbd_metrics.html) ### **v1.1.0** #### **Add loading from Data Repository functionality** diff --git a/tests/testthat/test-cfbd_metrics_ppa_players_season.R b/tests/testthat/test-cfbd_metrics_ppa_players_season.R index 92e26ae7..d28d4ad9 100644 --- a/tests/testthat/test-cfbd_metrics_ppa_players_season.R +++ b/tests/testthat/test-cfbd_metrics_ppa_players_season.R @@ -1,23 +1,23 @@ -context("CFB Metrics PPA Players Season") - - -cols <- c( - "season", "id", "name", "position", "team", "conference", - "countable_plays", "avg_PPA_all", "avg_PPA_pass", - "avg_PPA_rush", "avg_PPA_first_down", "avg_PPA_second_down", - "avg_PPA_third_down", "avg_PPA_standard_downs", "avg_PPA_passing_downs", - "total_PPA_all", "total_PPA_pass", "total_PPA_rush", "total_PPA_first_down", - "total_PPA_second_down", "total_PPA_third_down", - "total_PPA_standard_downs", "total_PPA_passing_downs" -) - -test_that("CFB Metrics PPA Players Season", { - skip_on_cran() - x <- cfbd_metrics_ppa_players_season(year = 2019, team = "TCU") - - y <- cfbd_metrics_ppa_players_season(year = 2019, team = "Alabama") - expect_equal(colnames(x), cols) - expect_equal(colnames(y), cols) - expect_s3_class(x, "data.frame") - expect_s3_class(y, "data.frame") -}) +context("CFB Metrics PPA Players Season") + + +cols <- c( + "season", "athlete_id", "name", "position", "team", "conference", + "countable_plays", "avg_PPA_all", "avg_PPA_pass", + "avg_PPA_rush", "avg_PPA_first_down", "avg_PPA_second_down", + "avg_PPA_third_down", "avg_PPA_standard_downs", "avg_PPA_passing_downs", + "total_PPA_all", "total_PPA_pass", "total_PPA_rush", "total_PPA_first_down", + "total_PPA_second_down", "total_PPA_third_down", + "total_PPA_standard_downs", "total_PPA_passing_downs" +) + +test_that("CFB Metrics PPA Players Season", { + skip_on_cran() + x <- cfbd_metrics_ppa_players_season(year = 2019, team = "TCU") + + y <- cfbd_metrics_ppa_players_season(year = 2019, team = "Alabama") + expect_equal(colnames(x), cols) + expect_equal(colnames(y), cols) + expect_s3_class(x, "data.frame") + expect_s3_class(y, "data.frame") +})