diff --git a/DESCRIPTION b/DESCRIPTION index 44f73c4..0d03cdb 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: nflseedR Title: Functions to Efficiently Simulate and Evaluate NFL Seasons -Version: 1.1.0.9002 +Version: 1.2.0 Authors@R: c( person("Lee", "Sharpe", role = c("aut", "cph")), person("Sebastian", "Carl", , "mrcaseb@gmail.com", role = c("cre", "aut")) diff --git a/NEWS.md b/NEWS.md index 5941fa1..d8fb439 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,7 +1,7 @@ -# nflseedR (development version) +# nflseedR 1.2.0 * `simulate_nfl()` gained the new argument `sim_include` to allow more access to what is actually being simulated. This makes it possible skip playoff simulation or the (possibly heavy) computation of draft order. (#34) -* The `summary` method `summary.nflseedR_simulation()` now hides columns where all values are `NA`. This is useful if `simulate_nfl()` skips the postseason or draft order. The method also reformats the number of simulations in the subtitle, e.g. from "10000" to "10k" (this requires scales >= 1.2.0, but it is a good idea to update scales anyways). (#35) +* The `summary` method `summary.nflseedR_simulation()` now hides columns where all values are `NA`. This is useful if `simulate_nfl()` skips the postseason or draft order. The method also re-formats the number of simulations in the subtitle, e.g. from "10000" to "10k" (this requires scales >= 1.2.0, but it is a good idea to update scales anyways). (#35) * `simulate_nfl()` now uses data.table to combine simulation rounds data. This is a significant performance improvement. The returned list `"sim_params"` now includes the package version of nflseedR (for debugging) and the current system time when the simulation was finished. (#36) * Lots of internal improvements to reduce package dependencies and messaging. (#36) * The `summary` method `summary.nflseedR_simulation()` now uses `fmt_pct_special()` to format probability strings to avoid the impression of overconfidence by rounding to integer percentages. (#37) diff --git a/R/compute_conference_seeds.R b/R/compute_conference_seeds.R index b7e7f56..2992177 100644 --- a/R/compute_conference_seeds.R +++ b/R/compute_conference_seeds.R @@ -22,12 +22,14 @@ #' old <- options(list(digits = 3, tibble.print_min = 64)) #' library(dplyr, warn.conflicts = FALSE) #' +#' try({#to avoid CRAN test problems #' nflseedR::load_sharpe_games() %>% #' dplyr::filter(season %in% 2019:2020) %>% #' dplyr::select(sim = season, game_type, week, away_team, home_team, result) %>% #' nflseedR::compute_division_ranks() %>% #' nflseedR::compute_conference_seeds(h2h = .$h2h) %>% #' purrr::pluck("standings") +#' }) #' #' # Restore old options #' options(old) diff --git a/R/compute_division_ranks.R b/R/compute_division_ranks.R index 1dda54d..0c07947 100644 --- a/R/compute_division_ranks.R +++ b/R/compute_division_ranks.R @@ -54,11 +54,13 @@ #' old <- options(list(digits = 3, tibble.print_min = 64)) #' library(dplyr, warn.conflicts = FALSE) #' +#' try({#to avoid CRAN test problems #' nflseedR::load_sharpe_games() %>% #' dplyr::filter(season %in% 2019:2020) %>% #' dplyr::select(sim = season, game_type, week, away_team, home_team, result) %>% #' nflseedR::compute_division_ranks() %>% #' purrr::pluck("standings") +#' }) #' #' # Restore old options #' options(old) diff --git a/R/compute_draft_order.R b/R/compute_draft_order.R index 7f167e2..a865ebe 100644 --- a/R/compute_draft_order.R +++ b/R/compute_draft_order.R @@ -15,6 +15,7 @@ #' old <- options(list(digits = 3, tibble.print_min = 64)) #' library(dplyr, warn.conflicts = FALSE) #' +#' try({#to avoid CRAN test problems #' games <- #' nflseedR::load_sharpe_games() %>% #' dplyr::filter(season %in% 2018:2019) %>% @@ -24,6 +25,7 @@ #' nflseedR::compute_division_ranks() %>% #' nflseedR::compute_conference_seeds(h2h = .$h2h, playoff_seeds = 6) %>% #' nflseedR::compute_draft_order(games = games, h2h = .$h2h) +#' }) #' #' # Restore old options #' options(old) diff --git a/R/load_sharpe_games.R b/R/load_sharpe_games.R index 3836036..14a4874 100644 --- a/R/load_sharpe_games.R +++ b/R/load_sharpe_games.R @@ -9,8 +9,10 @@ #' @seealso The internally called function [nflreadr::load_schedules()] #' @examples #' \donttest{ +#' try({#to avoid CRAN test problems #' games <- load_sharpe_games() #' dplyr::glimpse(games) +#' }) #' \dontshow{ #' # Close open connections for R CMD Check #' future::plan("sequential") diff --git a/R/simulate_nfl.R b/R/simulate_nfl.R index a94b5f9..11c491b 100644 --- a/R/simulate_nfl.R +++ b/R/simulate_nfl.R @@ -84,7 +84,7 @@ #' @returns An `nflseedR_simulation` object containing a list of 6 data frames #' data frames with the results of all simulated games, #' the final standings in each simulated season (incl. playoffs and draft order), -#' summary statistics across all simulated seasons, and the siumulation parameters. For a full list, +#' summary statistics across all simulated seasons, and the simulation parameters. For a full list, #' please see [the package website](https://nflseedr.com/articles/articles/nflsim.html#simulation-output). #' @seealso The examples [on the package website](https://nflseedr.com/articles/articles/nflsim.html) #' @seealso The method [nflseedR::summary.nflseedR_simulation()] that creates a pretty html summary table. @@ -99,6 +99,7 @@ #' # Parallel processing can be activated via the following line #' # future::plan("multisession") #' +#' try({#to avoid CRAN test problems #' # Simulate the season 4 times in 2 rounds #' sim <- nflseedR::simulate_nfl( #' nfl_season = 2020, @@ -109,6 +110,7 @@ #' #' # Overview output #' dplyr::glimpse(sim) +#' }) #' } simulate_nfl <- function(nfl_season = NULL, process_games = NULL, diff --git a/README.md b/README.md index 22fbbe3..a5ded9b 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ pak::pak("nflverse/nflseedR") or prebuilt from the [development repo](https://nflverse.r-universe.dev) with: -```r +``` r install.packages("nflseedR", repos = c("https://nflverse.r-universe.dev", getOption("repos"))) ``` diff --git a/cran-comments.md b/cran-comments.md index 72a8aae..690fd8f 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,6 +1,6 @@ ## Release summary -This a minor release, adding a new method and improving some functions. +This a minor release improving some functions. ## R CMD check results @@ -8,7 +8,9 @@ This a minor release, adding a new method and improving some functions. ## revdepcheck results -We checked 0 reverse dependencies, comparing R CMD check results across CRAN and dev versions of this package. +We checked 2 reverse dependencies, comparing R CMD check results across CRAN and dev versions of this package. * We saw 0 new problems * We failed to check 0 packages + + diff --git a/man/compute_conference_seeds.Rd b/man/compute_conference_seeds.Rd index f449372..335b19b 100644 --- a/man/compute_conference_seeds.Rd +++ b/man/compute_conference_seeds.Rd @@ -57,12 +57,14 @@ Compute NFL Playoff Seedings using Game Results and Divisional Rankings old <- options(list(digits = 3, tibble.print_min = 64)) library(dplyr, warn.conflicts = FALSE) +try({#to avoid CRAN test problems nflseedR::load_sharpe_games() \%>\% dplyr::filter(season \%in\% 2019:2020) \%>\% dplyr::select(sim = season, game_type, week, away_team, home_team, result) \%>\% nflseedR::compute_division_ranks() \%>\% nflseedR::compute_conference_seeds(h2h = .$h2h) \%>\% purrr::pluck("standings") +}) # Restore old options options(old) diff --git a/man/compute_division_ranks.Rd b/man/compute_division_ranks.Rd index 139e3ce..3a60e00 100644 --- a/man/compute_division_ranks.Rd +++ b/man/compute_division_ranks.Rd @@ -75,11 +75,13 @@ Compute NFL Division Rankings using Game Results old <- options(list(digits = 3, tibble.print_min = 64)) library(dplyr, warn.conflicts = FALSE) +try({#to avoid CRAN test problems nflseedR::load_sharpe_games() \%>\% dplyr::filter(season \%in\% 2019:2020) \%>\% dplyr::select(sim = season, game_type, week, away_team, home_team, result) \%>\% nflseedR::compute_division_ranks() \%>\% purrr::pluck("standings") +}) # Restore old options options(old) diff --git a/man/compute_draft_order.Rd b/man/compute_draft_order.Rd index 47e498e..9529f23 100644 --- a/man/compute_draft_order.Rd +++ b/man/compute_draft_order.Rd @@ -61,6 +61,7 @@ Compute NFL Draft Order using Game Results and Divisional Rankings old <- options(list(digits = 3, tibble.print_min = 64)) library(dplyr, warn.conflicts = FALSE) +try({#to avoid CRAN test problems games <- nflseedR::load_sharpe_games() \%>\% dplyr::filter(season \%in\% 2018:2019) \%>\% @@ -70,6 +71,7 @@ games \%>\% nflseedR::compute_division_ranks() \%>\% nflseedR::compute_conference_seeds(h2h = .$h2h, playoff_seeds = 6) \%>\% nflseedR::compute_draft_order(games = games, h2h = .$h2h) +}) # Restore old options options(old) diff --git a/man/load_schedules.Rd b/man/load_schedules.Rd index a8571dd..25b7c2d 100644 --- a/man/load_schedules.Rd +++ b/man/load_schedules.Rd @@ -97,8 +97,10 @@ having to remember the correct url. } \examples{ \donttest{ +try({#to avoid CRAN test problems games <- load_sharpe_games() dplyr::glimpse(games) +}) \dontshow{ # Close open connections for R CMD Check future::plan("sequential") diff --git a/man/simulate_nfl.Rd b/man/simulate_nfl.Rd index c677c88..658ce50 100644 --- a/man/simulate_nfl.Rd +++ b/man/simulate_nfl.Rd @@ -83,7 +83,7 @@ Simulation will behave as follows: An \code{nflseedR_simulation} object containing a list of 6 data frames data frames with the results of all simulated games, the final standings in each simulated season (incl. playoffs and draft order), -summary statistics across all simulated seasons, and the siumulation parameters. For a full list, +summary statistics across all simulated seasons, and the simulation parameters. For a full list, please see \href{https://nflseedr.com/articles/articles/nflsim.html#simulation-output}{the package website}. } \description{ @@ -158,6 +158,7 @@ library(nflseedR) # Parallel processing can be activated via the following line # future::plan("multisession") +try({#to avoid CRAN test problems # Simulate the season 4 times in 2 rounds sim <- nflseedR::simulate_nfl( nfl_season = 2020, @@ -168,6 +169,7 @@ sim <- nflseedR::simulate_nfl( # Overview output dplyr::glimpse(sim) +}) } } \seealso{