From e5424ca2da4b49bd48ed02d29a6387a0e45705da Mon Sep 17 00:00:00 2001 From: Kiernan Nicholls Date: Thu, 2 May 2024 21:15:14 -0400 Subject: [PATCH] Use historical team roster in vignette --- DESCRIPTION | 2 +- R/roster.R | 6 ++++-- README.Rmd | 4 ---- man/roster_score.Rd | 3 ++- man/start_roster.Rd | 3 ++- tests/testthat/test-live.R | 4 ---- tests/testthat/test-outlook.R | 4 ---- vignettes/fantasy-football.Rmd | 4 ++-- 8 files changed, 11 insertions(+), 19 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 7ab51ad0..fc333ba9 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -30,4 +30,4 @@ Encoding: UTF-8 Language: en-US LazyData: true Roxygen: list(markdown = TRUE) -RoxygenNote: 7.2.3 +RoxygenNote: 7.3.1 diff --git a/R/roster.R b/R/roster.R index 6c12d0e3..7483df90 100644 --- a/R/roster.R +++ b/R/roster.R @@ -137,7 +137,8 @@ out_roster <- function(entry, tid, tm, wk, yr, es = FALSE) { #' @param roster A roster data frame from [team_roster()]. #' @return A data frame of starters on a roster. #' @examples -#' start_roster(team_roster(leagueId = "42654852")[[1]]) +#' rost <- team_roster(leagueId = "42654852", leagueHistory = TRUE)[[1]][[1]] +#' start_roster(rost) #' @family roster functions #' @export start_roster <- function(roster) { @@ -152,7 +153,8 @@ start_roster <- function(roster) { #' @param useScore One of "projectedScore" or "actualScore" (default). #' @return A starting score as double. #' @examples -#' roster_score(team_roster(leagueId = "42654852")[[1]]) +#' rost <- team_roster(leagueId = "42654852", leagueHistory = TRUE)[[1]][[1]] +#' roster_score(rost) #' @family roster functions #' @export roster_score <- function(roster, diff --git a/README.Rmd b/README.Rmd index 9403c10d..80e68643 100644 --- a/README.Rmd +++ b/README.Rmd @@ -115,11 +115,7 @@ contributing, you agree to abide by its terms. [cov_badge]: https://codecov.io/gh/k5cents/fflr/graph/badge.svg?token=CMz6DIxJdH [cov_link]: https://app.codecov.io/gh/k5cents/fflr?branch=master [dl_badge]: https://cranlogs.r-pkg.org/badges/grand-total/fflr -<<<<<<< HEAD [api]: https://lm-api-reads.fantasy.espn.com/apis/v3/games/ffl/ -[iss]: https://github.com/kiernann/fflr/issues -======= -[api]: https://fantasy.espn.com/apis/v3/games/ffl/ [iss]: https://github.com/k5cents/fflr/issues >>>>>>> 51d8f8313cb57960ba168ad9b476f2d226482453 [cran]: https://cran.r-project.org/package=fflr diff --git a/man/roster_score.Rd b/man/roster_score.Rd index c4fb019a..c91cea0b 100644 --- a/man/roster_score.Rd +++ b/man/roster_score.Rd @@ -18,7 +18,8 @@ A starting score as double. For a given roster tibble, sum the starting scores. } \examples{ -roster_score(team_roster(leagueId = "42654852")[[1]]) +rost <- team_roster(leagueId = "42654852", leagueHistory = TRUE)[[1]][[1]] +roster_score(rost) } \seealso{ Other roster functions: diff --git a/man/start_roster.Rd b/man/start_roster.Rd index 43889da0..889b7b30 100644 --- a/man/start_roster.Rd +++ b/man/start_roster.Rd @@ -17,7 +17,8 @@ The starting 9 man roster using standard roster slots. In the future this function may be adapted to take roster slots from \code{\link[=roster_settings]{roster_settings()}}. } \examples{ -start_roster(team_roster(leagueId = "42654852")[[1]]) +rost <- team_roster(leagueId = "42654852", leagueHistory = TRUE)[[1]][[1]] +start_roster(rost) } \seealso{ Other roster functions: diff --git a/tests/testthat/test-live.R b/tests/testthat/test-live.R index 242a26da..c9b0b8d4 100644 --- a/tests/testthat/test-live.R +++ b/tests/testthat/test-live.R @@ -1,10 +1,6 @@ test_that("live scoring returns 1 row per team", { -<<<<<<< HEAD l <- live_scoring(leagueId = "42654852", yetToPlay = TRUE, bonusWin = TRUE) skip_empty(l) -======= - l <- live_scoring(leagueId = "42654852", yetToPlay = FALSE, bonusWin = TRUE) ->>>>>>> 51d8f8313cb57960ba168ad9b476f2d226482453 expect_s3_class(l, "data.frame") # expect_true("toPlay" %in% names(l)) expect_length(l, 7) diff --git a/tests/testthat/test-outlook.R b/tests/testthat/test-outlook.R index 2a972b3d..1e7141ef 100644 --- a/tests/testthat/test-outlook.R +++ b/tests/testthat/test-outlook.R @@ -4,13 +4,9 @@ test_that("get individual player outlook", { limit = 1 ) expect_s3_class(o, "data.frame") -<<<<<<< HEAD - expect_length(o, 5) -======= if (is.na(o$outlook)) { expect_length(o, 5) } else { expect_length(o, 6) } ->>>>>>> 51d8f8313cb57960ba168ad9b476f2d226482453 }) diff --git a/vignettes/fantasy-football.Rmd b/vignettes/fantasy-football.Rmd index 68e303ed..2cdba71e 100644 --- a/vignettes/fantasy-football.Rmd +++ b/vignettes/fantasy-football.Rmd @@ -88,8 +88,8 @@ website. Players are listed in order of their "slot" with name and team information followed by projected and actual scores and ownership statistics. ```{r team-roster} -my_team <- team_roster(scoringPeriodId = 1)[[1]] # select first roster -my_team[, -(1:3)] +my_team <- team_roster(scoringPeriodId = 1, leagueHistory = TRUE)[[1]] # select first roster +my_team[[1]][, -(1:3)] ``` ### News