From 03782485a4ec155145da49da0476c498a1b019e2 Mon Sep 17 00:00:00 2001 From: Paul Regular Date: Fri, 15 Sep 2023 15:20:00 -0230 Subject: [PATCH] Wrap slower examples in donttest --- CRAN-SUBMISSION | 4 ++-- R/run_strat.R | 12 ++++++++---- R/sim_dist.R | 6 ++++-- R/sim_survey.R | 13 +++++++------ man/run_strat.Rd | 6 ++++-- man/sim_distribution.Rd | 6 ++++-- man/sim_sets.Rd | 7 ++++--- man/sim_survey.Rd | 6 +++--- man/strat_error.Rd | 6 ++++-- 9 files changed, 40 insertions(+), 26 deletions(-) diff --git a/CRAN-SUBMISSION b/CRAN-SUBMISSION index 8390db3..1ca92b5 100644 --- a/CRAN-SUBMISSION +++ b/CRAN-SUBMISSION @@ -1,3 +1,3 @@ Version: 0.1.6 -Date: 2023-09-15 14:36:22 UTC -SHA: ffef972b998aa57344055c9e8d19428ec2bcb12d +Date: 2023-09-15 16:02:07 UTC +SHA: 8a489a48ddcde0fd7b4554e983c3c3b9ffd77acf diff --git a/R/run_strat.R b/R/run_strat.R index ee4c4aa..b4ea94d 100644 --- a/R/run_strat.R +++ b/R/run_strat.R @@ -200,13 +200,15 @@ strat_means <- function(data = NULL, metric = NULL, strat_groups = NULL, #' #' @examples #' -#' sim <- sim_abundance(ages = 1:3, years = 1:3, +#' \donttest{ +#' sim <- sim_abundance(ages = 1:5, years = 1:5, #' R = sim_R(log_mean = log(1e+7)), #' growth = sim_vonB(length_group = 1)) %>% -#' sim_distribution(grid = make_grid(res = c(22, 22)), +#' sim_distribution(grid = make_grid(res = c(20, 20)), #' ays_covar = sim_ays_covar(sd = 1)) %>% #' sim_survey(n_sims = 1, q = sim_logistic(k = 2, x0 = 3)) %>% #' run_strat() +#' } #' #' @export #' @@ -272,14 +274,16 @@ run_strat <- function(sim, #' #' @examples #' -#' sim <- sim_abundance(ages = 1:3, years = 1:3, +#' \donttest{ +#' sim <- sim_abundance(ages = 1:5, years = 1:5, #' R = sim_R(log_mean = log(1e+7)), #' growth = sim_vonB(length_group = 1)) %>% -#' sim_distribution(grid = make_grid(res = c(22, 22)), +#' sim_distribution(grid = make_grid(res = c(20, 20)), #' ays_covar = sim_ays_covar(sd = 1)) %>% #' sim_survey(n_sims = 1, q = sim_logistic(k = 2, x0 = 3)) %>% #' run_strat() %>% #' strat_error() +#' } #' #' @export #' diff --git a/R/sim_dist.R b/R/sim_dist.R index 3714fec..f6723c0 100644 --- a/R/sim_dist.R +++ b/R/sim_dist.R @@ -325,14 +325,16 @@ sim_nlf <- function(formula = ~ alpha - ((depth - mu) ^ 2) / (2 * sigma ^ 2), #' #' @examples #' -#' sim <- sim_abundance(ages = 1:3, years = 1:3) %>% -#' sim_distribution(grid = make_grid(res = c(22, 22)), +#' \donttest{ +#' sim <- sim_abundance(ages = 1:5, years = 1:5) %>% +#' sim_distribution(grid = make_grid(res = c(20, 20)), #' ays_covar = sim_ays_covar(phi_age = 0.8, #' phi_year = 0.1), #' depth_par = sim_parabola(mu = 200, #' sigma = 50)) #' head(sim$sp_N) #' head(sim$grid_xy) +#' } #' #' @export #' diff --git a/R/sim_survey.R b/R/sim_survey.R index 1cfb1b7..8ccb025 100644 --- a/R/sim_survey.R +++ b/R/sim_survey.R @@ -64,8 +64,9 @@ round_sim <- function(sim) { #' #' @examples #' -#' sim <- sim_abundance(ages = 1:3, years = 1:3) %>% -#' sim_distribution(grid = make_grid(res = c(22, 22))) +#'\donttest{ +#' sim <- sim_abundance(ages = 1:5, years = 1:5) %>% +#' sim_distribution(grid = make_grid(res = c(20, 20))) #' #' ## Multiple calls can be useful for defining a custom series of sets #' standard_sets <- sim_sets(sim, year <= 2, set_den = 2 / 1000) @@ -74,7 +75,7 @@ round_sim <- function(sim) { #' sets$set <- seq(nrow(sets)) # Important - make sure set has a unique ID. #' #' survey <- sim_survey(sim, custom_sets = sets) -#' \donttest{ +#' #' plot_survey(survey, which_year = 3, which_sim = 1) #' } #' @@ -166,10 +167,10 @@ sim_sets <- function(sim, subset_cells, n_sims = 1, trawl_dim = c(1.5, 0.02), #' #' @examples #' -#' sim <- sim_abundance(ages = 1:3, years = 1:3) %>% -#' sim_distribution(grid = make_grid(res = c(22, 22))) %>% +#'\donttest{ +#' sim <- sim_abundance(ages = 1:5, years = 1:5) %>% +#' sim_distribution(grid = make_grid(res = c(20, 20))) %>% #' sim_survey(n_sims = 5, q = sim_logistic(k = 2, x0 = 3)) -#' \donttest{ #' plot_survey(sim, which_year = 3, which_sim = 1) #' } #' diff --git a/man/run_strat.Rd b/man/run_strat.Rd index 2492f02..9186c15 100644 --- a/man/run_strat.Rd +++ b/man/run_strat.Rd @@ -43,12 +43,14 @@ The \code{"strat_data_fun"} and \code{"strat_means_fun"} allow the use of custom } \examples{ -sim <- sim_abundance(ages = 1:3, years = 1:3, +\donttest{ +sim <- sim_abundance(ages = 1:5, years = 1:5, R = sim_R(log_mean = log(1e+7)), growth = sim_vonB(length_group = 1)) \%>\% - sim_distribution(grid = make_grid(res = c(22, 22)), + sim_distribution(grid = make_grid(res = c(20, 20)), ays_covar = sim_ays_covar(sd = 1)) \%>\% sim_survey(n_sims = 1, q = sim_logistic(k = 2, x0 = 3)) \%>\% run_strat() +} } diff --git a/man/sim_distribution.Rd b/man/sim_distribution.Rd index fcf2c02..e4c8599 100644 --- a/man/sim_distribution.Rd +++ b/man/sim_distribution.Rd @@ -45,13 +45,15 @@ abundance in a large grid across many ages and years - start small first. } \examples{ -sim <- sim_abundance(ages = 1:3, years = 1:3) \%>\% - sim_distribution(grid = make_grid(res = c(22, 22)), +\donttest{ +sim <- sim_abundance(ages = 1:5, years = 1:5) \%>\% + sim_distribution(grid = make_grid(res = c(20, 20)), ays_covar = sim_ays_covar(phi_age = 0.8, phi_year = 0.1), depth_par = sim_parabola(mu = 200, sigma = 50)) head(sim$sp_N) head(sim$grid_xy) +} } diff --git a/man/sim_sets.Rd b/man/sim_sets.Rd index ea43e1d..0d7b3f1 100644 --- a/man/sim_sets.Rd +++ b/man/sim_sets.Rd @@ -38,8 +38,9 @@ Simulate survey sets } \examples{ -sim <- sim_abundance(ages = 1:3, years = 1:3) \%>\% - sim_distribution(grid = make_grid(res = c(22, 22))) +\donttest{ +sim <- sim_abundance(ages = 1:5, years = 1:5) \%>\% + sim_distribution(grid = make_grid(res = c(20, 20))) ## Multiple calls can be useful for defining a custom series of sets standard_sets <- sim_sets(sim, year <= 2, set_den = 2 / 1000) @@ -48,7 +49,7 @@ sets <- rbind(standard_sets, reduced_sets) sets$set <- seq(nrow(sets)) # Important - make sure set has a unique ID. survey <- sim_survey(sim, custom_sets = sets) -\donttest{ + plot_survey(survey, which_year = 3, which_sim = 1) } diff --git a/man/sim_survey.Rd b/man/sim_survey.Rd index 7b53469..5ae336c 100644 --- a/man/sim_survey.Rd +++ b/man/sim_survey.Rd @@ -81,10 +81,10 @@ Simulate stratified-random survey } \examples{ -sim <- sim_abundance(ages = 1:3, years = 1:3) \%>\% - sim_distribution(grid = make_grid(res = c(22, 22))) \%>\% - sim_survey(n_sims = 5, q = sim_logistic(k = 2, x0 = 3)) \donttest{ +sim <- sim_abundance(ages = 1:5, years = 1:5) \%>\% + sim_distribution(grid = make_grid(res = c(20, 20))) \%>\% + sim_survey(n_sims = 5, q = sim_logistic(k = 2, x0 = 3)) plot_survey(sim, which_year = 3, which_sim = 1) } diff --git a/man/strat_error.Rd b/man/strat_error.Rd index 1005b1b..705422f 100644 --- a/man/strat_error.Rd +++ b/man/strat_error.Rd @@ -22,13 +22,15 @@ Calculate error of stratified estimates } \examples{ -sim <- sim_abundance(ages = 1:3, years = 1:3, +\donttest{ +sim <- sim_abundance(ages = 1:5, years = 1:5, R = sim_R(log_mean = log(1e+7)), growth = sim_vonB(length_group = 1)) \%>\% - sim_distribution(grid = make_grid(res = c(22, 22)), + sim_distribution(grid = make_grid(res = c(20, 20)), ays_covar = sim_ays_covar(sd = 1)) \%>\% sim_survey(n_sims = 1, q = sim_logistic(k = 2, x0 = 3)) \%>\% run_strat() \%>\% strat_error() +} }