Skip to content

Commit 51ab37f

Browse files
committed
small touchups
1 parent 278c080 commit 51ab37f

File tree

5 files changed

+31
-36
lines changed

5 files changed

+31
-36
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: SimDesign
22
Title: Structure for Organizing Monte Carlo Simulation Designs
3-
Version: 2.21.3
3+
Version: 2.21.4
44
Authors@R: c(person("Phil", "Chalmers", email = "[email protected]", role = c("aut", "cre"),
55
comment = c(ORCID="0000-0001-5332-2810")),
66
person("Matthew", "Sigal", role = c("ctb")),

R/analysis.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Analysis <- function(Functions, condition, replications, fixed_objects, prepare
3131
write(prepare_Random.seed, file.path(save_results_out_rootdir, filename), sep = ' ')
3232
}
3333

34-
prep_result <- try(prepare(condition=condition, fixed_objects=fixed_objects), silent=FALSE)
34+
prep_result <- try(prepare(condition=condition, fixed_objects=fixed_objects), silent=TRUE)
3535

3636
if(is(prep_result, 'try-error')){
3737
# Capture seed on error (similar to mainsim)

R/runSimulation.R

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@
218218
#'
219219
#' \code{ fixed_objects$expensive_stuff <- readRDS(fname)}
220220
#'
221-
#' \code{ return(fixed_objects)}
221+
#' \code{ fixed_objects}
222222
#'
223223
#' \code{\}}
224224
#'
@@ -834,10 +834,7 @@
834834
#' head(res[[1]]$results)
835835
#'
836836
#' # just first condition
837-
#' res <- SimResults(Final, which=1)
838-
#' head(res$results)
839-
#' dplyr::tibble(res$condition, res$results)
840-
#'
837+
#' SimResults(Final, which=1)
841838
#'
842839
#' # obtain empirical bootstrapped CIs during an initial run
843840
#' # the simulation was completed (necessarily requires save_results = TRUE)
@@ -968,19 +965,12 @@
968965
#' generate=Generate, analyse=Analyse, summarise=Summarise,
969966
#' parallel=TRUE, debug='analyse-2')
970967
#'
968+
#' }
969+
#'
971970
#'
972971
#' ####################################
973-
#' ## EXTRA: To run the simulation on a user-define cluster, use the following setup (not run)
974-
# library(doMPI)
975-
# cl <- startMPIcluster()
976-
# registerDoMPI(cl)
977-
# Final <- runSimulation(design=Design, replications=1000, MPI=TRUE,
978-
# generate=Generate, analyse=Analyse, summarise=Summarise)
979-
# saveRDS(Final, 'mysim.rds')
980-
# closeCluster(cl)
981-
# mpi.quit()
982-
#
983-
#
972+
#'
973+
#' \dontrun{
984974
#' ## Network linked via ssh (two way ssh key-paired connection must be
985975
#' ## possible between master and slave nodes)
986976
#' ##
@@ -1027,12 +1017,15 @@
10271017
#' # reset future computing plan when complete (good practice)
10281018
#' plan(sequential)
10291019
#'
1020+
#' }
1021+
#'
10301022
#' ####################################
10311023
#'
10321024
#' ###### Post-analysis: Analyze the results via functions like lm() or SimAnova(), and create
10331025
#' ###### tables(dplyr) or plots (ggplot2) to help visualize the results.
10341026
#' ###### This is where you get to be a data analyst!
10351027
#'
1028+
#'
10361029
#' library(dplyr)
10371030
#' res %>% summarise(mean(welch), mean(independent))
10381031
#' res %>% group_by(standard_deviation_ratio, group_size_ratio) %>%
@@ -1135,9 +1128,7 @@
11351128
#' results
11361129
#'
11371130
#' # Cleanup
1138-
#' unlink('prepared_objects', recursive = TRUE)
1139-
#'
1140-
#' }
1131+
#' SimClean(dirs='prepared_objects')
11411132
#'
11421133
#' }
11431134
#'

man/runSimulation.Rd

Lines changed: 10 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/tests/test-04-prepare.R

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,17 +83,20 @@ test_that('prepare RNG management', {
8383
return(fixed_objects)
8484
}
8585

86-
res_fail <- tryCatch(
86+
runSimulation(Design[2,], replications=1,
87+
prepare=prepare_error,
88+
generate=generate,
89+
analyse=analyse,
90+
summarise=summarise,
91+
verbose=FALSE)
92+
93+
expect_error(
8794
runSimulation(Design[2,], replications=1,
8895
prepare=prepare_error,
8996
generate=generate,
9097
analyse=analyse,
9198
summarise=summarise,
92-
verbose=FALSE),
93-
error = function(e) e
94-
)
95-
96-
expect_true(inherits(res_fail, 'error'))
99+
verbose=FALSE))
97100

98101
# Test 5: load_seed_prepare with file path
99102
res5 <- runSimulation(Design, replications=2,

0 commit comments

Comments
 (0)