Skip to content

Commit

Permalink
cfbd_metrics_ppa_players_season.R move id to athlete_id
Browse files Browse the repository at this point in the history
  • Loading branch information
saiemgilani committed Apr 22, 2021
1 parent d61279d commit d5d66cf
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 24 deletions.
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**
Expand Down
3 changes: 2 additions & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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**
Expand Down
46 changes: 23 additions & 23 deletions tests/testthat/test-cfbd_metrics_ppa_players_season.R
Original file line number Diff line number Diff line change
@@ -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")
})

0 comments on commit d5d66cf

Please sign in to comment.