CRAN Package Check Results for Package goldilocks

Last updated on 2026-10-08 12:03:36 CEST.

Flavor Version Tinstall Tcheck Ttotal Status Flags
r-devel-linux-x86_64-debian-clang 1.0.0 25.02 544.81 569.83 OK
r-devel-linux-x86_64-debian-gcc 1.0.0 17.88 352.01 369.89 OK
r-devel-linux-x86_64-fedora-clang 1.0.0 20.00 357.57 377.57 OK
r-devel-linux-x86_64-fedora-gcc 1.0.0 20.00 364.81 384.81 OK
r-devel-windows-x86_64 1.0.0 42.00 513.00 555.00 OK
r-patched-linux-x86_64 1.0.0 26.98 520.14 547.12 OK
r-release-linux-x86_64 1.0.0 OK
r-release-macos-arm64 1.0.0 6.00 96.00 102.00 OK
r-release-macos-x86_64 1.0.0 20.00 473.00 493.00 OK
r-release-windows-x86_64 1.0.0 43.00 436.00 479.00 OK
r-oldrel-macos-arm64 1.0.0 ERROR
r-oldrel-macos-x86_64 1.0.0 19.00 406.00 425.00 OK
r-oldrel-windows-x86_64 1.0.0 52.00 594.00 646.00 OK

Check Details

Version: 1.0.0
Check: re-building of vignette outputs
Result: ERROR Error(s) in re-building vignettes: --- re-building ‘advent.Rmd’ using rmarkdown *** caught segfault *** address 0x110, cause 'invalid permissions' Traceback: 1: impute_predictive_arm(time = rep.int(0, length(future_treatment)), hazards = treatment_hazards, random_input = random_inputs$future_treatment, end_of_study = end_of_study, cutpoints = cutpoints, binary_imputation = binary_imputation) 2: fill_predictive_imputations(imputations = future, rows = future_treatment, values = impute_predictive_arm(time = rep.int(0, length(future_treatment)), hazards = treatment_hazards, random_input = random_inputs$future_treatment, end_of_study = end_of_study, cutpoints = cutpoints, binary_imputation = binary_imputation)) 3: impute_predictive_draws(data_in = data_interim, hazards = post_lambda, end_of_study = end_of_study, cutpoints = cutpoints, single_arm = single_arm, binary_imputation = predictive_binary_imputation, check_futility = check_futility) 4: evaluate_interim_decision(data_interim = data_interim, look = i, planned_N = analysis_at_enrollnumber[i], calendar_time = look_time, active_followup = active_followup_at(data_total, look_time), end_of_study = end_of_study, rmst_tau = rmst_tau, cutpoints = cutpoints, single_arm = single_arm, prior_surv = prior_surv, prior_surv_final = prior_surv_final, prior_bin = prior_bin, bin_method = bin_method, alternative = alternative, h0 = h0, Fn = Fn[i], Sn = Sn[i], prob_ha = prob_ha, N_impute = N_impute, N_mcmc = N_mcmc, mc_conf_level = mc_conf_level, empty_interval = empty_interval, method = method, binary_imputation = binary_imputation, check_futility = check_futility, Qn = Qn[i]) 5: survival_adapt_fn(hazard_treatment = hazard_treatment, hazard_control = hazard_control, cutpoints = cutpoints, N_total = N_total, lambda = lambda, lambda_time = lambda_time, interim_look = interim_look, end_of_study = end_of_study, prior_surv = prior_surv, prior_bin = prior_bin, bin_method = bin_method, binary_imputation = binary_imputation, block = block, rand_ratio = rand_ratio, prop_loss = prop_loss, alternative = alternative, h0 = h0, Fn = Fn, Sn = Sn, Qn = Qn, prob_ha = prob_ha, N_impute = N_impute, N_mcmc = N_mcmc, mc_conf_level = mc_conf_level, method = method, imputed_final = imputed_final, empty_interval = empty_interval, return_trace = return_trace, prior_surv_final = prior_surv_final, generation_cutpoints = generation_cutpoints, rmst_tau = rmst_tau) 6: doTryCatch(return(expr), name, parentenv, handler) 7: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8: tryCatchList(expr, classes, parentenv, handlers) 9: tryCatch({ if (!is.null(trial_streams)) { assign(".Random.seed", trial_streams[[x]], envir = .GlobalEnv) } result <- survival_adapt_fn(hazard_treatment = hazard_treatment, hazard_control = hazard_control, cutpoints = cutpoints, N_total = N_total, lambda = lambda, lambda_time = lambda_time, interim_look = interim_look, end_of_study = end_of_study, prior_surv = prior_surv, prior_bin = prior_bin, bin_method = bin_method, binary_imputation = binary_imputation, block = block, rand_ratio = rand_ratio, prop_loss = prop_loss, alternative = alternative, h0 = h0, Fn = Fn, Sn = Sn, Qn = Qn, prob_ha = prob_ha, N_impute = N_impute, N_mcmc = N_mcmc, mc_conf_level = mc_conf_level, method = method, imputed_final = imputed_final, empty_interval = empty_interval, return_trace = return_trace, prior_surv_final = prior_surv_final, generation_cutpoints = generation_cutpoints, rmst_tau = rmst_tau) attr(result, "arguments") <- NULL if (inherits(result, "goldilocks_trial")) { attr(result$summary, "arguments") <- NULL } list(trial = as.integer(x), result = result)}, error = function(error) { list(trial = as.integer(x), result = NULL, error_class = class(error)[1L], message = conditionMessage(error))}) 10: FUN(X[[i]], ...) 11: lapply(X = S, FUN = FUN, ...) 12: doTryCatch(return(expr), name, parentenv, handler) 13: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 14: tryCatchList(expr, classes, parentenv, handlers) 15: tryCatch(expr, error = function(e) { call <- conditionCall(e) if (!is.null(call)) { if (identical(call[[1L]], quote(doTryCatch))) call <- sys.call(-4L) dcall <- deparse(call, nlines = 1L) prefix <- paste("Error in", dcall, ": ") LONG <- 75L sm <- strsplit(conditionMessage(e), "\n")[[1L]] w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w") if (is.na(w)) w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], type = "b") if (w > LONG) prefix <- paste0(prefix, "\n ") } else prefix <- "Error : " msg <- paste0(prefix, conditionMessage(e), "\n") .Internal(seterrmessage(msg[1L])) if (!silent && isTRUE(getOption("show.error.messages"))) { cat(msg, file = outFile) .Internal(printDeferredWarnings()) } invisible(structure(msg, class = "try-error", condition = e))}) 16: try(lapply(X = S, FUN = FUN, ...), silent = TRUE) 17: sendMaster(try(lapply(X = S, FUN = FUN, ...), silent = TRUE)) 18: FUN(X[[i]], ...) 19: lapply(seq_len(cores), inner.do) 20: mclapply(X, FUN, ..., mc.cores = mc.cores, mc.preschedule = mc.preschedule, mc.set.seed = mc.set.seed, mc.cleanup = mc.cleanup, mc.allow.recursive = mc.allow.recursive) 21: pbmclapply(trial_index, survival_adapt_wrapper, mc.cores = workers) 22: (function (hazard_treatment, hazard_control = NULL, cutpoints = NULL, N_total, lambda = 0.3, lambda_time = NULL, interim_look = NULL, end_of_study, prior_surv = c(0.1, 0.1), prior_bin = c(1, 1), bin_method = "mc", block = 2, rand_ratio = c(control = 1, treatment = 1), prop_loss = 0, alternative = "greater", h0 = 0, Fn = 0.05, Sn = 0.9, prob_ha = 0.95, N_impute = 500, N_mcmc = 1000, mc_conf_level = 0.95, N_trials = 10, method = "logrank", imputed_final = FALSE, empty_interval = c("prior", "propagate", "error"), return_trace = FALSE, ncores = 1L, backend = c("auto", "fork", "psock", "sequential"), seed = NULL, binary_imputation = c("event-time", "bernoulli"), prior_surv_final = prior_surv, generation_cutpoints = cutpoints, Qn = 1, rmst_tau = end_of_study) { Call <- match.call() Arguments <- capture_arguments(sim_trials, environment()) method <- normalize_analysis_method(method) Arguments$method <- method empty_interval <- match.arg(empty_interval) binary_imputation <- match.arg(binary_imputation) backend <- match.arg(backend) Arguments$empty_interval <- empty_interval Arguments$binary_imputation <- binary_imputation Arguments$backend <- backend requested_backend <- backend caller_rng_kind <- RNGkind() validate_positive_integer_scalar(N_trials, "N_trials") single_arm <- is.null(hazard_control) if (!single_arm) { rand_ratio <- validate_randomization_args(N_total, block, rand_ratio, allocation_name = "rand_ratio") Arguments$rand_ratio <- rand_ratio } prop_loss <- normalize_prop_loss(prop_loss, single_arm = single_arm) Arguments$prop_loss <- prop_loss validate_logical_scalar(return_trace, "return_trace") validate_positive_integer_scalar(N_impute, "N_impute") validate_positive_integer_scalar(N_mcmc, "N_mcmc") validate_single_probability(mc_conf_level, "mc_conf_level", upper_open = TRUE) if (mc_conf_level <= 0.5) { stop("'mc_conf_level' must be greater than 0.5 and less than 1") } validate_final_imputation(method, imputed_final, has_missing_outcomes = any(prop_loss > 0), N_impute = N_impute) if (identical(method, "rmst")) { validate_endpoint_time(end_of_study, cutpoints, "end_of_study") validate_rmst_args(rmst_tau, end_of_study, h0) validate_analysis_configuration(method, alternative, is.null(hazard_control), imputed_final) } validate_positive_integer_scalar(ncores, "ncores") execution <- resolve_sim_execution(backend = backend, ncores = ncores, N_trials = N_trials) backend <- execution$backend workers <- execution$workers stream_seed <- NULL if (!is.null(seed)) { if (length(seed) != 1 || !is.numeric(seed) || is.na(seed) || !is.finite(seed) || seed != floor(seed)) { stop("'seed' must be NULL or a single integer value") } old_kind <- RNGkind() old_seed_exists <- exists(".Random.seed", envir = .GlobalEnv, inherits = FALSE) if (old_seed_exists) { old_seed <- get(".Random.seed", envir = .GlobalEnv, inherits = FALSE) } on.exit({ do.call(RNGkind, as.list(old_kind)) if (old_seed_exists) { assign(".Random.seed", old_seed, envir = .GlobalEnv) } else if (exists(".Random.seed", envir = .GlobalEnv, inherits = FALSE)) { rm(".Random.seed", envir = .GlobalEnv) } }, add = TRUE) stream_seed <- seed trial_streams <- make_rng_streams(stream_seed, N_trials) } else if (backend == "psock") { stream_seed <- sample.int(.Machine$integer.max - 1L, size = 1L) trial_streams <- make_rng_streams(stream_seed, N_trials) } else { trial_streams <- NULL } rng_metadata <- list(caller_kind = caller_rng_kind, stream_kind = if (is.null(trial_streams)) { caller_rng_kind[1] } else { "L'Ecuyer-CMRG" }, seed_policy = if (!is.null(seed)) { "explicit_preserve_caller" } else if (backend == "psock") { "caller_derived_psock" } else { "caller_state" }, backend = backend, ncores = as.integer(workers), requested_ncores = as.integer(ncores), stream_seed = stream_seed) survival_adapt_fn <- if (backend == "psock") { make_psock_callable("survival_adapt") } else { survival_adapt } survival_adapt_wrapper <- function(x) { tryCatch({ if (!is.null(trial_streams)) { assign(".Random.seed", trial_streams[[x]], envir = .GlobalEnv) } result <- survival_adapt_fn(hazard_treatment = hazard_treatment, hazard_control = hazard_control, cutpoints = cutpoints, N_total = N_total, lambda = lambda, lambda_time = lambda_time, interim_look = interim_look, end_of_study = end_of_study, prior_surv = prior_surv, prior_bin = prior_bin, bin_method = bin_method, binary_imputation = binary_imputation, block = block, rand_ratio = rand_ratio, prop_loss = prop_loss, alternative = alternative, h0 = h0, Fn = Fn, Sn = Sn, Qn = Qn, prob_ha = prob_ha, N_impute = N_impute, N_mcmc = N_mcmc, mc_conf_level = mc_conf_level, method = method, imputed_final = imputed_final, empty_interval = empty_interval, return_trace = return_trace, prior_surv_final = prior_surv_final, generation_cutpoints = generation_cutpoints, rmst_tau = rmst_tau) attr(result, "arguments") <- NULL if (inherits(result, "goldilocks_trial")) { attr(result$summary, "arguments") <- NULL } list(trial = as.integer(x), result = result) }, error = function(error) { list(trial = as.integer(x), result = NULL, error_class = class(error)[1L], message = conditionMessage(error)) }) } trial_index <- seq_len(N_trials) trial_results <- switch(backend, sequential = lapply(trial_index, survival_adapt_wrapper), fork = pbmclapply(trial_index, survival_adapt_wrapper, mc.cores = workers), psock = { active_cluster <- make_sim_cluster(workers) on.exit(stop_sim_cluster(active_cluster), add = TRUE) initialize_sim_cluster(active_cluster) run_sim_cluster(active_cluster, trial_index, survival_adapt_wrapper) }) failed <- vapply(trial_results, function(x) is.null(x$result), logical(1)) failed_results <- trial_results[failed] failures <- data.frame(trial = vapply(failed_results, `[[`, integer(1), "trial"), error_class = vapply(failed_results, `[[`, character(1), "error_class"), message = vapply(failed_results, `[[`, character(1), "message"), stringsAsFactors = FALSE) if (all(failed)) { error <- simpleError(paste0("All ", N_trials, " simulated trials failed. First error: ", failures$message[1L])) error$failures <- failures class(error) <- c("goldilocks_all_trials_failed", class(error)) stop(error) } successful_trials <- trial_results[!failed] successful_results <- lapply(successful_trials, `[[`, "result") if (return_trace) { sims <- bind_rows(lapply(successful_results, function(x) x$summary)) traces <- bind_rows(lapply(seq_along(successful_results), function(i) { trace <- successful_results[[i]]$trace trial <- successful_trials[[i]]$trial trace$trial <- rep.int(trial, nrow(trace)) trace[c("trial", setdiff(names(trace), "trial"))] })) out <- list(sims = sims, traces = traces, failures = failures, call = Call) } else { sims <- bind_rows(successful_results) out <- list(sims = sims, failures = failures, call = Call) } attr(out$sims, "arguments") <- NULL attr(out, "enrollment_design") <- new_enrollment_design(lambda = lambda, N_total = N_total, lambda_time = lambda_time, interim_look = interim_look, end_of_study = end_of_study) attr(out, "decision_design") <- attr(successful_results[[1]], "decision_design", exact = TRUE) attr(out, "prior_design") <- attr(successful_results[[1]], "prior_design", exact = TRUE) attr(out, "rng_metadata") <- rng_metadata attr(out, "arguments") <- Arguments attr(out, "parallel_metadata") <- list(requested_backend = requested_backend, backend = backend, selection_reason = execution$reason, requested_ncores = as.integer(ncores), workers = as.integer(workers), tasks = as.integer(N_trials)) if (nrow(failures) > 0L) { warning(nrow(failures), " of ", N_trials, " simulated trials failed and were excluded. See `result$failures` ", "for details.", call. = FALSE) } return(out)})(N_total = 750, lambda = c(0.0666666666666667, 0.166666666666667, 0.333333333333333, 0.5, 0.666666666666667, 0.833333333333333, 1, 1.1), lambda_time = c(30L, 60L, 90L, 120L, 150L, 180L, 210L), interim_look = c(350, 450, 550, 650), end_of_study = 360L, prior_surv = c(0.5, 0.001, 0.5, 0.001, 0.5, 0.001, 0.5, 0.001, 5, 10000), prior_surv_final = c(shape = 0.5, rate = 0.001 ), prior_bin = c(0.5, 0.5), bin_method = "quadrature", block = 2, rand_ratio = c(control = 1, treatment = 1), alternative = "less", Fn = c(0.05, 0.1, 0.1, 0.1), Sn = c(0.95, 0.9, 0.85, 0.8), N_impute = 30, empty_interval = "prior", method = "bayes-bin", imputed_final = TRUE, ncores = 2, cutpoints = c(90, 104, 150, 210), prop_loss = 0.075, N_trials = 500, hazard_treatment = c(0.00011167, 0.002197976, 0.003163208, 0.002839089, 0.000494053), hazard_control = c(0.00011167, 0.002197976, 0.003163208, 0.002839089, 0.000494053), h0 = 0.15, prob_ha = 0.956, return_trace = TRUE, seed = 4610) 23: do.call(sim_trials, c(advent_effectiveness_args, list(N_trials = 500, hazard_treatment = eff_hazard_per_day, hazard_control = eff_hazard_per_day, h0 = 0.15, prob_ha = 0.956, return_trace = TRUE, seed = 4610))) 24: eval(expr, envir) 25: eval(expr, envir) 26: withVisible(eval(expr, envir)) 27: withCallingHandlers(code, error = function (e) rlang::entrace(e), message = function (cnd) { watcher$capture_plot_and_output() if (on_message$capture) { watcher$push(cnd) } if (on_message$silence) { invokeRestart("muffleMessage") }}, warning = function (cnd) { if (getOption("warn") >= 2 || getOption("warn") < 0) { return() } watcher$capture_plot_and_output() if (on_warning$capture) { cnd <- sanitize_call(cnd) watcher$push(cnd) } if (on_warning$silence) { invokeRestart("muffleWarning") }}, error = function (cnd) { watcher$capture_plot_and_output() cnd <- sanitize_call(cnd) watcher$push(cnd) switch(on_error, continue = invokeRestart("eval_continue"), stop = invokeRestart("eval_stop"), error = NULL)}) 28: eval(call) 29: eval(call) 30: with_handlers({ for (expr in tle$exprs) { ev <- withVisible(eval(expr, envir)) watcher$capture_plot_and_output() watcher$print_value(ev$value, ev$visible, envir) } TRUE}, handlers) 31: doWithOneRestart(return(expr), restart) 32: withOneRestart(expr, restarts[[1L]]) 33: withRestartList(expr, restarts[-nr]) 34: doWithOneRestart(return(expr), restart) 35: withOneRestart(withRestartList(expr, restarts[-nr]), restarts[[nr]]) 36: withRestartList(expr, restarts) 37: withRestarts(with_handlers({ for (expr in tle$exprs) { ev <- withVisible(eval(expr, envir)) watcher$capture_plot_and_output() watcher$print_value(ev$value, ev$visible, envir) } TRUE}, handlers), eval_continue = function() TRUE, eval_stop = function() FALSE) 38: evaluate::evaluate(...) 39: evaluate(code, envir = env, new_device = FALSE, keep_warning = if (is.numeric(options$warning)) TRUE else options$warning, keep_message = if (is.numeric(options$message)) TRUE else options$message, stop_on_error = if (is.numeric(options$error)) options$error else { if (options$error && options$include) 0L else 2L }, output_handler = knit_handlers(options$render, options)) 40: in_dir(input_dir(), expr) 41: in_input_dir(evaluate(code, envir = env, new_device = FALSE, keep_warning = if (is.numeric(options$warning)) TRUE else options$warning, keep_message = if (is.numeric(options$message)) TRUE else options$message, stop_on_error = if (is.numeric(options$error)) options$error else { if (options$error && options$include) 0L else 2L }, output_handler = knit_handlers(options$render, options))) 42: eng_r(options) 43: block_exec(params) 44: call_block(x) 45: process_group(group) 46: withCallingHandlers(if (tangle) process_tangle(group) else process_group(group), error = function(e) { if (progress && is.function(pb$interrupt)) pb$interrupt() if (is_R_CMD_build() || is_R_CMD_check()) error <<- format(e) }) 47: with_options(withCallingHandlers(if (tangle) process_tangle(group) else process_group(group), error = function(e) { if (progress && is.function(pb$interrupt)) pb$interrupt() if (is_R_CMD_build() || is_R_CMD_check()) error <<- format(e) }), list(rlang_trace_top_env = knit_global())) 48: xfun:::handle_error(with_options(withCallingHandlers(if (tangle) process_tangle(group) else process_group(group), error = function(e) { if (progress && is.function(pb$interrupt)) pb$interrupt() if (is_R_CMD_build() || is_R_CMD_check()) error <<- format(e) }), list(rlang_trace_top_env = knit_global())), function(loc) { setwd(wd) write_utf8(res, output %n% stdout()) paste0("\nQuitting from ", loc, if (!is.null(error)) paste0("\n", rule(), error, "\n", rule()))}, if (labels[i] != "") sprintf(" [%s]", labels[i]), get_loc) 49: process_file(text, output) 50: knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet) 51: rmarkdown::render(file, encoding = encoding, quiet = quiet, envir = globalenv(), output_dir = getwd(), ...) 52: vweave_rmarkdown(...) 53: engine$weave(file, quiet = quiet, encoding = enc) 54: doTryCatch(return(expr), name, parentenv, handler) 55: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 56: tryCatchList(expr, classes, parentenv, handlers) 57: tryCatch({ engine$weave(file, quiet = quiet, encoding = enc) setwd(startdir) output <- find_vignette_product(name, by = "weave", engine = engine) if (!have.makefile && vignette_is_tex(output)) { texi2pdf(file = output, clean = FALSE, quiet = quiet) output <- find_vignette_product(name, by = "texi2pdf", engine = engine) }}, error = function(e) { OK <<- FALSE message(gettextf("Error: processing vignette '%s' failed with diagnostics:\n%s", file, conditionMessage(e)))}) 58: tools:::.buildOneVignette("advent.Rmd", "/Volumes/Builds/packages/big-sur-arm64/results/4.5/goldilocks.Rcheck/vign_test/goldilocks", TRUE, TRUE, "advent", "UTF-8", "/Volumes/Temp/tmp/RtmpwR6fcO/file8c9f4c840b02.rds") An irrecoverable exception occurred. R is aborting now ... *** caught segfault *** address 0x110, cause 'invalid permissions' Traceback: 1: impute_predictive_arm(time = rep.int(0, length(future_treatment)), hazards = treatment_hazards, random_input = random_inputs$future_treatment, end_of_study = end_of_study, cutpoints = cutpoints, binary_imputation = binary_imputation) 2: fill_predictive_imputations(imputations = future, rows = future_treatment, values = impute_predictive_arm(time = rep.int(0, length(future_treatment)), hazards = treatment_hazards, random_input = random_inputs$future_treatment, end_of_study = end_of_study, cutpoints = cutpoints, binary_imputation = binary_imputation)) 3: impute_predictive_draws(data_in = data_interim, hazards = post_lambda, end_of_study = end_of_study, cutpoints = cutpoints, single_arm = single_arm, binary_imputation = predictive_binary_imputation, check_futility = check_futility) 4: evaluate_interim_decision(data_interim = data_interim, look = i, planned_N = analysis_at_enrollnumber[i], calendar_time = look_time, active_followup = active_followup_at(data_total, look_time), end_of_study = end_of_study, rmst_tau = rmst_tau, cutpoints = cutpoints, single_arm = single_arm, prior_surv = prior_surv, prior_surv_final = prior_surv_final, prior_bin = prior_bin, bin_method = bin_method, alternative = alternative, h0 = h0, Fn = Fn[i], Sn = Sn[i], prob_ha = prob_ha, N_impute = N_impute, N_mcmc = N_mcmc, mc_conf_level = mc_conf_level, empty_interval = empty_interval, method = method, binary_imputation = binary_imputation, check_futility = check_futility, Qn = Qn[i]) 5: survival_adapt_fn(hazard_treatment = hazard_treatment, hazard_control = hazard_control, cutpoints = cutpoints, N_total = N_total, lambda = lambda, lambda_time = lambda_time, interim_look = interim_look, end_of_study = end_of_study, prior_surv = prior_surv, prior_bin = prior_bin, bin_method = bin_method, binary_imputation = binary_imputation, block = block, rand_ratio = rand_ratio, prop_loss = prop_loss, alternative = alternative, h0 = h0, Fn = Fn, Sn = Sn, Qn = Qn, prob_ha = prob_ha, N_impute = N_impute, N_mcmc = N_mcmc, mc_conf_level = mc_conf_level, method = method, imputed_final = imputed_final, empty_interval = empty_interval, return_trace = return_trace, prior_surv_final = prior_surv_final, generation_cutpoints = generation_cutpoints, rmst_tau = rmst_tau) 6: doTryCatch(return(expr), name, parentenv, handler) 7: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8: tryCatchList(expr, classes, parentenv, handlers) 9: tryCatch({ if (!is.null(trial_streams)) { assign(".Random.seed", trial_streams[[x]], envir = .GlobalEnv) } result <- survival_adapt_fn(hazard_treatment = hazard_treatment, hazard_control = hazard_control, cutpoints = cutpoints, N_total = N_total, lambda = lambda, lambda_time = lambda_time, interim_look = interim_look, end_of_study = end_of_study, prior_surv = prior_surv, prior_bin = prior_bin, bin_method = bin_method, binary_imputation = binary_imputation, block = block, rand_ratio = rand_ratio, prop_loss = prop_loss, alternative = alternative, h0 = h0, Fn = Fn, Sn = Sn, Qn = Qn, prob_ha = prob_ha, N_impute = N_impute, N_mcmc = N_mcmc, mc_conf_level = mc_conf_level, method = method, imputed_final = imputed_final, empty_interval = empty_interval, return_trace = return_trace, prior_surv_final = prior_surv_final, generation_cutpoints = generation_cutpoints, rmst_tau = rmst_tau) attr(result, "arguments") <- NULL if (inherits(result, "goldilocks_trial")) { attr(result$summary, "arguments") <- NULL } list(trial = as.integer(x), result = result)}, error = function(error) { list(trial = as.integer(x), result = NULL, error_class = class(error)[1L], message = conditionMessage(error))}) 10: FUN(X[[i]], ...) 11: lapply(X = S, FUN = FUN, ...) 12: doTryCatch(return(expr), name, parentenv, handler) 13: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 14: tryCatchList(expr, classes, parentenv, handlers) 15: tryCatch(expr, error = function(e) { call <- conditionCall(e) if (!is.null(call)) { if (identical(call[[1L]], quote(doTryCatch))) call <- sys.call(-4L) dcall <- deparse(call, nlines = 1L) prefix <- paste("Error in", dcall, ": ") LONG <- 75L sm <- strsplit(conditionMessage(e), "\n")[[1L]] w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w") if (is.na(w)) w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], type = "b") if (w > LONG) prefix <- paste0(prefix, "\n ") } else prefix <- "Error : " msg <- paste0(prefix, conditionMessage(e), "\n") .Internal(seterrmessage(msg[1L])) if (!silent && isTRUE(getOption("show.error.messages"))) { cat(msg, file = outFile) .Internal(printDeferredWarnings()) } invisible(structure(msg, class = "try-error", condition = e))}) 16: try(lapply(X = S, FUN = FUN, ...), silent = TRUE) 17: sendMaster(try(lapply(X = S, FUN = FUN, ...), silent = TRUE)) 18: FUN(X[[i]], ...) 19: lapply(seq_len(cores), inner.do) 20: mclapply(X, FUN, ..., mc.cores = mc.cores, mc.preschedule = mc.preschedule, mc.set.seed = mc.set.seed, mc.cleanup = mc.cleanup, mc.allow.recursive = mc.allow.recursive) 21: pbmclapply(trial_index, survival_adapt_wrapper, mc.cores = workers) 22: (function (hazard_treatment, hazard_control = NULL, cutpoints = NULL, N_total, lambda = 0.3, lambda_time = NULL, interim_look = NULL, end_of_study, prior_surv = c(0.1, 0.1), prior_bin = c(1, 1), bin_method = "mc", block = 2, rand_ratio = c(control = 1, treatment = 1), prop_loss = 0, alternative = "greater", h0 = 0, Fn = 0.05, Sn = 0.9, prob_ha = 0.95, N_impute = 500, N_mcmc = 1000, mc_conf_level = 0.95, N_trials = 10, method = "logrank", imputed_final = FALSE, empty_interval = c("prior", "propagate", "error"), return_trace = FALSE, ncores = 1L, backend = c("auto", "fork", "psock", "sequential"), seed = NULL, binary_imputation = c("event-time", "bernoulli"), prior_surv_final = prior_surv, generation_cutpoints = cutpoints, Qn = 1, rmst_tau = end_of_study) { Call <- match.call() Arguments <- capture_arguments(sim_trials, environment()) method <- normalize_analysis_method(method) Arguments$method <- method empty_interval <- match.arg(empty_interval) binary_imputation <- match.arg(binary_imputation) backend <- match.arg(backend) Arguments$empty_interval <- empty_interval Arguments$binary_imputation <- binary_imputation Arguments$backend <- backend requested_backend <- backend caller_rng_kind <- RNGkind() validate_positive_integer_scalar(N_trials, "N_trials") single_arm <- is.null(hazard_control) if (!single_arm) { rand_ratio <- validate_randomization_args(N_total, block, rand_ratio, allocation_name = "rand_ratio") Arguments$rand_ratio <- rand_ratio } prop_loss <- normalize_prop_loss(prop_loss, single_arm = single_arm) Arguments$prop_loss <- prop_loss validate_logical_scalar(return_trace, "return_trace") validate_positive_integer_scalar(N_impute, "N_impute") validate_positive_integer_scalar(N_mcmc, "N_mcmc") validate_single_probability(mc_conf_level, "mc_conf_level", upper_open = TRUE) if (mc_conf_level <= 0.5) { stop("'mc_conf_level' must be greater than 0.5 and less than 1") } validate_final_imputation(method, imputed_final, has_missing_outcomes = any(prop_loss > 0), N_impute = N_impute) if (identical(method, "rmst")) { validate_endpoint_time(end_of_study, cutpoints, "end_of_study") validate_rmst_args(rmst_tau, end_of_study, h0) validate_analysis_configuration(method, alternative, is.null(hazard_control), imputed_final) } validate_positive_integer_scalar(ncores, "ncores") execution <- resolve_sim_execution(backend = backend, ncores = ncores, N_trials = N_trials) backend <- execution$backend workers <- execution$workers stream_seed <- NULL if (!is.null(seed)) { if (length(seed) != 1 || !is.numeric(seed) || is.na(seed) || !is.finite(seed) || seed != floor(seed)) { stop("'seed' must be NULL or a single integer value") } old_kind <- RNGkind() old_seed_exists <- exists(".Random.seed", envir = .GlobalEnv, inherits = FALSE) if (old_seed_exists) { old_seed <- get(".Random.seed", envir = .GlobalEnv, inherits = FALSE) } on.exit({ do.call(RNGkind, as.list(old_kind)) if (old_seed_exists) { assign(".Random.seed", old_seed, envir = .GlobalEnv) } else if (exists(".Random.seed", envir = .GlobalEnv, inherits = FALSE)) { rm(".Random.seed", envir = .GlobalEnv) } }, add = TRUE) stream_seed <- seed trial_streams <- make_rng_streams(stream_seed, N_trials) } else if (backend == "psock") { stream_seed <- sample.int(.Machine$integer.max - 1L, size = 1L) trial_streams <- make_rng_streams(stream_seed, N_trials) } else { trial_streams <- NULL } rng_metadata <- list(caller_kind = caller_rng_kind, stream_kind = if (is.null(trial_streams)) { caller_rng_kind[1] } else { "L'Ecuyer-CMRG" }, seed_policy = if (!is.null(seed)) { "explicit_preserve_caller" } else if (backend == "psock") { "caller_derived_psock" } else { "caller_state" }, backend = backend, ncores = as.integer(workers), requested_ncores = as.integer(ncores), stream_seed = stream_seed) survival_adapt_fn <- if (backend == "psock") { make_psock_callable("survival_adapt") } else { survival_adapt } survival_adapt_wrapper <- function(x) { tryCatch({ if (!is.null(trial_streams)) { assign(".Random.seed", trial_streams[[x]], envir = .GlobalEnv) } result <- survival_adapt_fn(hazard_treatment = hazard_treatment, hazard_control = hazard_control, cutpoints = cutpoints, N_total = N_total, lambda = lambda, lambda_time = lambda_time, interim_look = interim_look, end_of_study = end_of_study, prior_surv = prior_surv, prior_bin = prior_bin, bin_method = bin_method, binary_imputation = binary_imputation, block = block, rand_ratio = rand_ratio, prop_loss = prop_loss, alternative = alternative, h0 = h0, Fn = Fn, Sn = Sn, Qn = Qn, prob_ha = prob_ha, N_impute = N_impute, N_mcmc = N_mcmc, mc_conf_level = mc_conf_level, method = method, imputed_final = imputed_final, empty_interval = empty_interval, return_trace = return_trace, prior_surv_final = prior_surv_final, generation_cutpoints = generation_cutpoints, rmst_tau = rmst_tau) attr(result, "arguments") <- NULL if (inherits(result, "goldilocks_trial")) { attr(result$summary, "arguments") <- NULL } list(trial = as.integer(x), result = result) }, error = function(error) { list(trial = as.integer(x), result = NULL, error_class = class(error)[1L], message = conditionMessage(error)) }) } trial_index <- seq_len(N_trials) trial_results <- switch(backend, sequential = lapply(trial_index, survival_adapt_wrapper), fork = pbmclapply(trial_index, survival_adapt_wrapper, mc.cores = workers), psock = { active_cluster <- make_sim_cluster(workers) on.exit(stop_sim_cluster(active_cluster), add = TRUE) initialize_sim_cluster(active_cluster) run_sim_cluster(active_cluster, trial_index, survival_adapt_wrapper) }) failed <- vapply(trial_results, function(x) is.null(x$result), logical(1)) failed_results <- trial_results[failed] failures <- data.frame(trial = vapply(failed_results, `[[`, integer(1), "trial"), error_class = vapply(failed_results, `[[`, character(1), "error_class"), message = vapply(failed_results, `[[`, character(1), "message"), stringsAsFactors = FALSE) if (all(failed)) { error <- simpleError(paste0("All ", N_trials, " simulated trials failed. First error: ", failures$message[1L])) error$failures <- failures class(error) <- c("goldilocks_all_trials_failed", class(error)) stop(error) } successful_trials <- trial_results[!failed] successful_results <- lapply(successful_trials, `[[`, "result") if (return_trace) { sims <- bind_rows(lapply(successful_results, function(x) x$summary)) traces <- bind_rows(lapply(seq_along(successful_results), function(i) { trace <- successful_results[[i]]$trace trial <- successful_trials[[i]]$trial trace$trial <- rep.int(trial, nrow(trace)) trace[c("trial", setdiff(names(trace), "trial"))] })) out <- list(sims = sims, traces = traces, failures = failures, call = Call) } else { sims <- bind_rows(successful_results) out <- list(sims = sims, failures = failures, call = Call) } attr(out$sims, "arguments") <- NULL attr(out, "enrollment_design") <- new_enrollment_design(lambda = lambda, N_total = N_total, lambda_time = lambda_time, interim_look = interim_look, end_of_study = end_of_study) attr(out, "decision_design") <- attr(successful_results[[1]], "decision_design", exact = TRUE) attr(out, "prior_design") <- attr(successful_results[[1]], "prior_design", exact = TRUE) attr(out, "rng_metadata") <- rng_metadata attr(out, "arguments") <- Arguments attr(out, "parallel_metadata") <- list(requested_backend = requested_backend, backend = backend, selection_reason = execution$reason, requested_ncores = as.integer(ncores), workers = as.integer(workers), tasks = as.integer(N_trials)) if (nrow(failures) > 0L) { warning(nrow(failures), " of ", N_trials, " simulated trials failed and were excluded. See `result$failures` ", "for details.", call. = FALSE) } return(out)})(N_total = 750, lambda = c(0.0666666666666667, 0.166666666666667, 0.333333333333333, 0.5, 0.666666666666667, 0.833333333333333, 1, 1.1), lambda_time = c(30L, 60L, 90L, 120L, 150L, 180L, 210L), interim_look = c(350, 450, 550, 650), end_of_study = 360L, prior_surv = c(0.5, 0.001, 0.5, 0.001, 0.5, 0.001, 0.5, 0.001, 5, 10000), prior_surv_final = c(shape = 0.5, rate = 0.001 ), prior_bin = c(0.5, 0.5), bin_method = "quadrature", block = 2, rand_ratio = c(control = 1, treatment = 1), alternative = "less", Fn = c(0.05, 0.1, 0.1, 0.1), Sn = c(0.95, 0.9, 0.85, 0.8), N_impute = 30, empty_interval = "prior", method = "bayes-bin", imputed_final = TRUE, ncores = 2, cutpoints = c(90, 104, 150, 210), prop_loss = 0.075, N_trials = 500, hazard_treatment = c(0.00011167, 0.002197976, 0.003163208, 0.002839089, 0.000494053), hazard_control = c(0.00011167, 0.002197976, 0.003163208, 0.002839089, 0.000494053), h0 = 0.15, prob_ha = 0.956, return_trace = TRUE, seed = 4610) 23: do.call(sim_trials, c(advent_effectiveness_args, list(N_trials = 500, hazard_treatment = eff_hazard_per_day, hazard_control = eff_hazard_per_day, h0 = 0.15, prob_ha = 0.956, return_trace = TRUE, seed = 4610))) 24: eval(expr, envir) 25: eval(expr, envir) 26: withVisible(eval(expr, envir)) 27: withCallingHandlers(code, error = function (e) rlang::entrace(e), message = function (cnd) { watcher$capture_plot_and_output() if (on_message$capture) { watcher$push(cnd) } if (on_message$silence) { invokeRestart("muffleMessage") }}, warning = function (cnd) { if (getOption("warn") >= 2 || getOption("warn") < 0) { return() } watcher$capture_plot_and_output() if (on_warning$capture) { cnd <- sanitize_call(cnd) watcher$push(cnd) } if (on_warning$silence) { invokeRestart("muffleWarning") }}, error = function (cnd) { watcher$capture_plot_and_output() cnd <- sanitize_call(cnd) watcher$push(cnd) switch(on_error, continue = invokeRestart("eval_continue"), stop = invokeRestart("eval_stop"), error = NULL)}) 28: eval(call) 29: eval(call) 30: with_handlers({ for (expr in tle$exprs) { ev <- withVisible(eval(expr, envir)) watcher$capture_plot_and_output() watcher$print_value(ev$value, ev$visible, envir) } TRUE}, handlers) 31: doWithOneRestart(return(expr), restart) 32: withOneRestart(expr, restarts[[1L]]) 33: withRestartList(expr, restarts[-nr]) 34: doWithOneRestart(return(expr), restart) 35: withOneRestart(withRestartList(expr, restarts[-nr]), restarts[[nr]]) 36: withRestartList(expr, restarts) 37: withRestarts(with_handlers({ for (expr in tle$exprs) { ev <- withVisible(eval(expr, envir)) watcher$capture_plot_and_output() watcher$print_value(ev$value, ev$visible, envir) } TRUE}, handlers), eval_continue = function() TRUE, eval_stop = function() FALSE) 38: evaluate::evaluate(...) 39: evaluate(code, envir = env, new_device = FALSE, keep_warning = if (is.numeric(options$warning)) TRUE else options$warning, keep_message = if (is.numeric(options$message)) TRUE else options$message, stop_on_error = if (is.numeric(options$error)) options$error else { if (options$error && options$include) 0L else 2L }, output_handler = knit_handlers(options$render, options)) 40: in_dir(input_dir(), expr) 41: in_input_dir(evaluate(code, envir = env, new_device = FALSE, keep_warning = if (is.numeric(options$warning)) TRUE else options$warning, keep_message = if (is.numeric(options$message)) TRUE else options$message, stop_on_error = if (is.numeric(options$error)) options$error else { if (options$error && options$include) 0L else 2L }, output_handler = knit_handlers(options$render, options))) 42: eng_r(options) 43: block_exec(params) 44: call_block(x) 45: process_group(group) 46: withCallingHandlers(if (tangle) process_tangle(group) else process_group(group), error = function(e) { if (progress && is.function(pb$interrupt)) pb$interrupt() if (is_R_CMD_build() || is_R_CMD_check()) error <<- format(e) }) 47: with_options(withCallingHandlers(if (tangle) process_tangle(group) else process_group(group), error = function(e) { if (progress && is.function(pb$interrupt)) pb$interrupt() if (is_R_CMD_build() || is_R_CMD_check()) error <<- format(e) }), list(rlang_trace_top_env = knit_global())) 48: xfun:::handle_error(with_options(withCallingHandlers(if (tangle) process_tangle(group) else process_group(group), error = function(e) { if (progress && is.function(pb$interrupt)) pb$interrupt() if (is_R_CMD_build() || is_R_CMD_check()) error <<- format(e) }), list(rlang_trace_top_env = knit_global())), function(loc) { setwd(wd) write_utf8(res, output %n% stdout()) paste0("\nQuitting from ", loc, if (!is.null(error)) paste0("\n", rule(), error, "\n", rule()))}, if (labels[i] != "") sprintf(" [%s]", labels[i]), get_loc) 49: process_file(text, output) 50: knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet) 51: rmarkdown::render(file, encoding = encoding, quiet = quiet, envir = globalenv(), output_dir = getwd(), ...) 52: vweave_rmarkdown(...) 53: engine$weave(file, quiet = quiet, encoding = enc) 54: doTryCatch(return(expr), name, parentenv, handler) 55: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 56: tryCatchList(expr, classes, parentenv, handlers) 57: tryCatch({ engine$weave(file, quiet = quiet, encoding = enc) setwd(startdir) output <- find_vignette_product(name, by = "weave", engine = engine) if (!have.makefile && vignette_is_tex(output)) { texi2pdf(file = output, clean = FALSE, quiet = quiet) output <- find_vignette_product(name, by = "texi2pdf", engine = engine) }}, error = function(e) { OK <<- FALSE message(gettextf("Error: processing vignette '%s' failed with diagnostics:\n%s", file, conditionMessage(e)))}) 58: tools:::.buildOneVignette("advent.Rmd", "/Volumes/Builds/packages/big-sur-arm64/results/4.5/goldilocks.Rcheck/vign_test/goldilocks", TRUE, TRUE, "advent", "UTF-8", "/Volumes/Temp/tmp/RtmpwR6fcO/file8c9f4c840b02.rds") An irrecoverable exception occurred. R is aborting now ... Quitting from advent.Rmd:577-621 [oc-small] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <error/rlang_error> Error in `vapply()`: ! values must be length 1, but FUN(X[[1]]) result is length 0 --- Backtrace: ▆ 1. ├─base::do.call(...) 2. └─goldilocks (local) `<fn>`(...) 3. ├─base::data.frame(...) 4. └─base::vapply(failed_results, `[[`, integer(1), "trial") ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Error: processing vignette 'advent.Rmd' failed with diagnostics: values must be length 1, but FUN(X[[1]]) result is length 0 --- failed re-building ‘advent.Rmd’ --- re-building ‘anthem-hfref.Rmd’ using rmarkdown 2026-10-08 16:56:49.728 R[36574:356301] XType: Using static font registry. *** caught segfault *** address 0x110, cause 'invalid permissions' *** caught segfault *** address 0x110, cause 'invalid permissions' Traceback: 1: Traceback: impute_predictive_arm(time = data_in$time[current_treatment], 1: hazards = treatment_hazards, random_input = random_inputs$current_treatment, impute_predictive_arm(time = data_in$time[current_treatment], end_of_study = end_of_study, cutpoints = cutpoints, binary_imputation = binary_imputation) hazards = treatment_hazards, random_input = random_inputs$current_treatment, end_of_study = end_of_study, cutpoints = cutpoints, binary_imputation = binary_imputation) 2: fill_predictive_imputations(imputations = current, rows = current_treatment, 2: values = impute_predictive_arm(time = data_in$time[current_treatment], fill_predictive_imputations(imputations = current, rows = current_treatment, hazards = treatment_hazards, random_input = random_inputs$current_treatment, values = impute_predictive_arm(time = data_in$time[current_treatment], end_of_study = end_of_study, cutpoints = cutpoints, binary_imputation = binary_imputation)) hazards = treatment_hazards, random_input = random_inputs$current_treatment, end_of_study = end_of_study, cutpoints = cutpoints, binary_imputation = binary_imputation)) 3: impute_predictive_draws(data_in = data_interim, hazards = post_lambda, 3: end_of_study = end_of_study, cutpoints = cutpoints, single_arm = single_arm, impute_predictive_draws(data_in = data_interim, hazards = post_lambda, binary_imputation = predictive_binary_imputation, check_futility = check_futility) end_of_study = end_of_study, cutpoints = cutpoints, single_arm = single_arm, binary_imputation = predictive_binary_imputation, check_futility = check_futility) 4: evaluate_interim_decision(data_interim = data_interim, look = i, 4: planned_N = analysis_at_enrollnumber[i], calendar_time = look_time, evaluate_interim_decision(data_interim = data_interim, look = i, active_followup = active_followup_at(data_total, look_time), planned_N = analysis_at_enrollnumber[i], calendar_time = look_time, end_of_study = end_of_study, rmst_tau = rmst_tau, cutpoints = cutpoints, active_followup = active_followup_at(data_total, look_time), single_arm = single_arm, prior_surv = prior_surv, prior_surv_final = prior_surv_final, end_of_study = end_of_study, rmst_tau = rmst_tau, cutpoints = cutpoints, prior_bin = prior_bin, bin_method = bin_method, alternative = alternative, single_arm = single_arm, prior_surv = prior_surv, prior_surv_final = prior_surv_final, h0 = h0, Fn = Fn[i], Sn = Sn[i], prob_ha = prob_ha, N_impute = N_impute, prior_bin = prior_bin, bin_method = bin_method, alternative = alternative, N_mcmc = N_mcmc, mc_conf_level = mc_conf_level, empty_interval = empty_interval, h0 = h0, Fn = Fn[i], Sn = Sn[i], prob_ha = prob_ha, N_impute = N_impute, method = method, binary_imputation = binary_imputation, check_futility = check_futility, N_mcmc = N_mcmc, mc_conf_level = mc_conf_level, empty_interval = empty_interval, Qn = Qn[i]) method = method, binary_imputation = binary_imputation, check_futility = check_futility, Qn = Qn[i]) 5: survival_adapt_fn(hazard_treatment = hazard_treatment, hazard_control = hazard_control, 5: survival_adapt_fn(hazard_treatment = hazard_treatment, hazard_control = hazard_control, cutpoints = cutpoints, N_total = N_total, lambda = lambda, cutpoints = cutpoints, N_total = N_total, lambda = lambda, lambda_time = lambda_time, interim_look = interim_look, end_of_study = end_of_study, lambda_time = lambda_time, interim_look = interim_look, end_of_study = end_of_study, prior_surv = prior_surv, prior_bin = prior_bin, bin_method = bin_method, binary_imputation = binary_imputation, block = block, rand_ratio = rand_ratio, prior_surv = prior_surv, prior_bin = prior_bin, bin_method = bin_method, prop_loss = prop_loss, alternative = alternative, h0 = h0, Fn = Fn, Sn = Sn, Qn = Qn, prob_ha = prob_ha, N_impute = N_impute, binary_imputation = binary_imputation, block = block, rand_ratio = rand_ratio, N_mcmc = N_mcmc, mc_conf_level = mc_conf_level, method = method, prop_loss = prop_loss, alternative = alternative, h0 = h0, imputed_final = imputed_final, empty_interval = empty_interval, return_trace = return_trace, prior_surv_final = prior_surv_final, Fn = Fn, Sn = Sn, Qn = Qn, prob_ha = prob_ha, N_impute = N_impute, generation_cutpoints = generation_cutpoints, rmst_tau = rmst_tau) N_mcmc = N_mcmc, mc_conf_level = mc_conf_level, method = method, imputed_final = imputed_final, empty_interval = empty_interval, 6: return_trace = return_trace, prior_surv_final = prior_surv_final, doTryCatch(return(expr), name, parentenv, handler) generation_cutpoints = generation_cutpoints, rmst_tau = rmst_tau) 7: 6: tryCatchOne(expr, names, parentenv, handlers[[1L]])doTryCatch(return(expr), name, parentenv, handler) 8: tryCatchList(expr, classes, parentenv, handlers) 7: 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])tryCatch({ 8: if (!is.null(trial_streams)) {tryCatchList(expr, classes, parentenv, handlers) assign(".Random.seed", trial_streams[[x]], envir = .GlobalEnv) } 9: tryCatch({ result <- survival_adapt_fn(hazard_treatment = hazard_treatment, hazard_control = hazard_control, cutpoints = cutpoints, if (!is.null(trial_streams)) { N_total = N_total, lambda = lambda, lambda_time = lambda_time, assign(".Random.seed", trial_streams[[x]], envir = .GlobalEnv) interim_look = interim_look, end_of_study = end_of_study, } prior_surv = prior_surv, prior_bin = prior_bin, bin_method = bin_method, result <- survival_adapt_fn(hazard_treatment = hazard_treatment, binary_imputation = binary_imputation, block = block, rand_ratio = rand_ratio, prop_loss = prop_loss, alternative = alternative, hazard_control = hazard_control, cutpoints = cutpoints, h0 = h0, Fn = Fn, Sn = Sn, Qn = Qn, prob_ha = prob_ha, N_total = N_total, lambda = lambda, lambda_time = lambda_time, N_impute = N_impute, N_mcmc = N_mcmc, mc_conf_level = mc_conf_level, interim_look = interim_look, end_of_study = end_of_study, method = method, imputed_final = imputed_final, empty_interval = empty_interval, prior_surv = prior_surv, prior_bin = prior_bin, bin_method = bin_method, return_trace = return_trace, prior_surv_final = prior_surv_final, binary_imputation = binary_imputation, block = block, generation_cutpoints = generation_cutpoints, rmst_tau = rmst_tau) rand_ratio = rand_ratio, prop_loss = prop_loss, alternative = alternative, attr(result, "arguments") <- NULL if (inherits(result, "goldilocks_trial")) { h0 = h0, Fn = Fn, Sn = Sn, Qn = Qn, prob_ha = prob_ha, attr(result$summary, "arguments") <- NULL N_impute = N_impute, N_mcmc = N_mcmc, mc_conf_level = mc_conf_level, } method = method, imputed_final = imputed_final, empty_interval = empty_interval, list(trial = as.integer(x), result = result) return_trace = return_trace, prior_surv_final = prior_surv_final, }, error = function(error) { generation_cutpoints = generation_cutpoints, rmst_tau = rmst_tau) list(trial = as.integer(x), result = NULL, error_class = class(error)[1L], attr(result, "arguments") <- NULL message = conditionMessage(error)) if (inherits(result, "goldilocks_trial")) {}) attr(result$summary, "arguments") <- NULL } list(trial = as.integer(x), result = result)}, error = function(error) {10: list(trial = as.integer(x), result = NULL, error_class = class(error)[1L], FUN(X[[i]], ...) message = conditionMessage(error)) })11: 10: FUN(X[[i]], ...) lapply(X = S, FUN = FUN, ...)11: lapply(X = S, FUN = FUN, ...)12: doTryCatch(return(expr), name, parentenv, handler)12: doTryCatch(return(expr), name, parentenv, handler) 13: 13: tryCatchOne(expr, names, parentenv, handlers[[1L]])tryCatchOne(expr, names, parentenv, handlers[[1L]]) 14: 14: tryCatchList(expr, classes, parentenv, handlers)tryCatchList(expr, classes, parentenv, handlers) 15: 15: tryCatch(expr, error = function(e) {tryCatch(expr, error = function(e) { call <- conditionCall(e) call <- conditionCall(e) if (!is.null(call)) { if (!is.null(call)) { if (identical(call[[1L]], quote(doTryCatch))) if (identical(call[[1L]], quote(doTryCatch))) call <- sys.call(-4L) call <- sys.call(-4L) dcall <- deparse(call, nlines = 1L) dcall <- deparse(call, nlines = 1L) prefix <- paste("Error in", dcall, ": ") prefix <- paste("Error in", dcall, ": ") LONG <- 75L LONG <- 75L sm <- strsplit(conditionMessage(e), "\n")[[1L]] sm <- strsplit(conditionMessage(e), "\n")[[1L]] w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w") w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w") if (is.na(w)) if (is.na(w)) w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], type = "b") type = "b") if (w > LONG) if (w > LONG) prefix <- paste0(prefix, "\n ") } prefix <- paste0(prefix, "\n ") else prefix <- "Error : " } msg <- paste0(prefix, conditionMessage(e), "\n") .Internal(seterrmessage(msg[1L])) else prefix <- "Error : " if (!silent && isTRUE(getOption("show.error.messages"))) { msg <- paste0(prefix, conditionMessage(e), "\n") cat(msg, file = outFile) .Internal(seterrmessage(msg[1L])) .Internal(printDeferredWarnings()) if (!silent && isTRUE(getOption("show.error.messages"))) { } cat(msg, file = outFile) invisible(structure(msg, class = "try-error", condition = e)) .Internal(printDeferredWarnings())}) } invisible(structure(msg, class = "try-error", condition = e))16: })try(lapply(X = S, FUN = FUN, ...), silent = TRUE) 16: 17: try(lapply(X = S, FUN = FUN, ...), silent = TRUE)sendMaster(try(lapply(X = S, FUN = FUN, ...), silent = TRUE)) 17: 18: sendMaster(try(lapply(X = S, FUN = FUN, ...), silent = TRUE))FUN(X[[i]], ...) 18: 19: lapply(seq_len(cores), inner.do)FUN(X[[i]], ...) 20: 19: mclapply(X, FUN, ..., mc.cores = mc.cores, mc.preschedule = mc.preschedule, mc.set.seed = mc.set.seed, mc.cleanup = mc.cleanup, mc.allow.recursive = mc.allow.recursive)lapply(seq_len(cores), inner.do) 21: 20: mclapply(X, FUN, ..., mc.cores = mc.cores, mc.preschedule = mc.preschedule, mc.set.seed = mc.set.seed, mc.cleanup = mc.cleanup, mc.allow.recursive = mc.allow.recursive) pbmclapply(trial_index, survival_adapt_wrapper, mc.cores = workers)21: pbmclapply(trial_index, survival_adapt_wrapper, mc.cores = workers)22: (function (hazard_treatment, hazard_control = NULL, cutpoints = NULL, 22: N_total, lambda = 0.3, lambda_time = NULL, interim_look = NULL, (function (hazard_treatment, hazard_control = NULL, cutpoints = NULL, end_of_study, prior_surv = c(0.1, 0.1), prior_bin = c(1, N_total, lambda = 0.3, lambda_time = NULL, interim_look = NULL, 1), bin_method = "mc", block = 2, rand_ratio = c(control = 1, end_of_study, prior_surv = c(0.1, 0.1), prior_bin = c(1, treatment = 1), prop_loss = 0, alternative = "greater", 1), bin_method = "mc", block = 2, rand_ratio = c(control = 1, h0 = 0, Fn = 0.05, Sn = 0.9, prob_ha = 0.95, N_impute = 500, treatment = 1), prop_loss = 0, alternative = "greater", N_mcmc = 1000, mc_conf_level = 0.95, N_trials = 10, method = "logrank", imputed_final = FALSE, empty_interval = c("prior", "propagate", h0 = 0, Fn = 0.05, Sn = 0.9, prob_ha = 0.95, N_impute = 500, "error"), return_trace = FALSE, ncores = 1L, backend = c("auto", N_mcmc = 1000, mc_conf_level = 0.95, N_trials = 10, method = "logrank", "fork", "psock", "sequential"), seed = NULL, binary_imputation = c("event-time", imputed_final = FALSE, empty_interval = c("prior", "propagate", "bernoulli"), prior_surv_final = prior_surv, generation_cutpoints = cutpoints, "error"), return_trace = FALSE, ncores = 1L, backend = c("auto", Qn = 1, rmst_tau = end_of_study) "fork", "psock", "sequential"), seed = NULL, binary_imputation = c("event-time", "bernoulli"), prior_surv_final = prior_surv, generation_cutpoints = cutpoints, { Qn = 1, rmst_tau = end_of_study) Call <- match.call(){ Arguments <- capture_arguments(sim_trials, environment()) Call <- match.call() method <- normalize_analysis_method(method) Arguments <- capture_arguments(sim_trials, environment()) method <- normalize_analysis_method(method) Arguments$method <- method Arguments$method <- method empty_interval <- match.arg(empty_interval) empty_interval <- match.arg(empty_interval) binary_imputation <- match.arg(binary_imputation) binary_imputation <- match.arg(binary_imputation) backend <- match.arg(backend) backend <- match.arg(backend) Arguments$empty_interval <- empty_interval Arguments$empty_interval <- empty_interval Arguments$binary_imputation <- binary_imputation Arguments$binary_imputation <- binary_imputation Arguments$backend <- backend Arguments$backend <- backend requested_backend <- backend requested_backend <- backend caller_rng_kind <- RNGkind() caller_rng_kind <- RNGkind() validate_positive_integer_scalar(N_trials, "N_trials") validate_positive_integer_scalar(N_trials, "N_trials") single_arm <- is.null(hazard_control) single_arm <- is.null(hazard_control) if (!single_arm) { if (!single_arm) { rand_ratio <- validate_randomization_args(N_total, block, rand_ratio <- validate_randomization_args(N_total, block, rand_ratio, allocation_name = "rand_ratio") rand_ratio, allocation_name = "rand_ratio") Arguments$rand_ratio <- rand_ratio Arguments$rand_ratio <- rand_ratio } } prop_loss <- normalize_prop_loss(prop_loss, single_arm = single_arm) prop_loss <- normalize_prop_loss(prop_loss, single_arm = single_arm) Arguments$prop_loss <- prop_loss validate_logical_scalar(return_trace, "return_trace") Arguments$prop_loss <- prop_loss validate_positive_integer_scalar(N_impute, "N_impute") validate_logical_scalar(return_trace, "return_trace") validate_positive_integer_scalar(N_mcmc, "N_mcmc") validate_positive_integer_scalar(N_impute, "N_impute") validate_single_probability(mc_conf_level, "mc_conf_level", validate_positive_integer_scalar(N_mcmc, "N_mcmc") upper_open = TRUE) validate_single_probability(mc_conf_level, "mc_conf_level", if (mc_conf_level <= 0.5) { stop("'mc_conf_level' must be greater than 0.5 and less than 1") upper_open = TRUE) } if (mc_conf_level <= 0.5) { validate_final_imputation(method, imputed_final, has_missing_outcomes = any(prop_loss > stop("'mc_conf_level' must be greater than 0.5 and less than 1") 0), N_impute = N_impute) if (identical(method, "rmst")) { } validate_endpoint_time(end_of_study, cutpoints, "end_of_study") validate_final_imputation(method, imputed_final, has_missing_outcomes = any(prop_loss > validate_rmst_args(rmst_tau, end_of_study, h0) 0), N_impute = N_impute) validate_analysis_configuration(method, alternative, if (identical(method, "rmst")) { is.null(hazard_control), imputed_final) validate_endpoint_time(end_of_study, cutpoints, "end_of_study") } validate_rmst_args(rmst_tau, end_of_study, h0) validate_positive_integer_scalar(ncores, "ncores") execution <- resolve_sim_execution(backend = backend, ncores = ncores, validate_analysis_configuration(method, alternative, N_trials = N_trials) backend <- execution$backend is.null(hazard_control), imputed_final) workers <- execution$workers } stream_seed <- NULL validate_positive_integer_scalar(ncores, "ncores") execution <- resolve_sim_execution(backend = backend, ncores = ncores, if (!is.null(seed)) { N_trials = N_trials) if (length(seed) != 1 || !is.numeric(seed) || is.na(seed) || backend <- execution$backend !is.finite(seed) || seed != floor(seed)) { workers <- execution$workers stop("'seed' must be NULL or a single integer value") stream_seed <- NULL } if (!is.null(seed)) { old_kind <- RNGkind() if (length(seed) != 1 || !is.numeric(seed) || is.na(seed) || old_seed_exists <- exists(".Random.seed", envir = .GlobalEnv, !is.finite(seed) || seed != floor(seed)) { inherits = FALSE) stop("'seed' must be NULL or a single integer value") if (old_seed_exists) { } old_seed <- get(".Random.seed", envir = .GlobalEnv, old_kind <- RNGkind() inherits = FALSE) old_seed_exists <- exists(".Random.seed", envir = .GlobalEnv, } inherits = FALSE) if (old_seed_exists) { on.exit({ old_seed <- get(".Random.seed", envir = .GlobalEnv, inherits = FALSE) do.call(RNGkind, as.list(old_kind)) } if (old_seed_exists) { on.exit({ assign(".Random.seed", old_seed, envir = .GlobalEnv) } else if (exists(".Random.seed", envir = .GlobalEnv, do.call(RNGkind, as.list(old_kind)) inherits = FALSE)) { if (old_seed_exists) { rm(".Random.seed", envir = .GlobalEnv) assign(".Random.seed", old_seed, envir = .GlobalEnv) } else if (exists(".Random.seed", envir = .GlobalEnv, } inherits = FALSE)) { rm(".Random.seed", envir = .GlobalEnv) }, add = TRUE) } stream_seed <- seed }, add = TRUE) trial_streams <- make_rng_streams(stream_seed, N_trials) stream_seed <- seed } trial_streams <- make_rng_streams(stream_seed, N_trials) } else if (backend == "psock") { else if (backend == "psock") { stream_seed <- sample.int(.Machine$integer.max - 1L, stream_seed <- sample.int(.Machine$integer.max - 1L, size = 1L) size = 1L) trial_streams <- make_rng_streams(stream_seed, N_trials) trial_streams <- make_rng_streams(stream_seed, N_trials) } } else { trial_streams <- NULL else { } trial_streams <- NULL rng_metadata <- list(caller_kind = caller_rng_kind, stream_kind = if (is.null(trial_streams)) { } caller_rng_kind[1] } else { rng_metadata <- list(caller_kind = caller_rng_kind, stream_kind = if (is.null(trial_streams)) { "L'Ecuyer-CMRG" caller_rng_kind[1] }, seed_policy = if (!is.null(seed)) { "explicit_preserve_caller" } else { } else if (backend == "psock") { "L'Ecuyer-CMRG" "caller_derived_psock" }, seed_policy = if (!is.null(seed)) { } else { "explicit_preserve_caller" "caller_state" } else if (backend == "psock") { }, backend = backend, ncores = as.integer(workers), requested_ncores = as.integer(ncores), "caller_derived_psock" stream_seed = stream_seed) } else { survival_adapt_fn <- if (backend == "psock") { "caller_state" make_psock_callable("survival_adapt") }, backend = backend, ncores = as.integer(workers), requested_ncores = as.integer(ncores), stream_seed = stream_seed) } survival_adapt_fn <- if (backend == "psock") { else { make_psock_callable("survival_adapt") survival_adapt } } else { survival_adapt_wrapper <- function(x) { tryCatch({ survival_adapt if (!is.null(trial_streams)) { } assign(".Random.seed", trial_streams[[x]], envir = .GlobalEnv) survival_adapt_wrapper <- function(x) { } tryCatch({ result <- survival_adapt_fn(hazard_treatment = hazard_treatment, hazard_control = hazard_control, cutpoints = cutpoints, if (!is.null(trial_streams)) { N_total = N_total, lambda = lambda, lambda_time = lambda_time, interim_look = interim_look, end_of_study = end_of_study, assign(".Random.seed", trial_streams[[x]], envir = .GlobalEnv) prior_surv = prior_surv, prior_bin = prior_bin, } bin_method = bin_method, binary_imputation = binary_imputation, block = block, rand_ratio = rand_ratio, prop_loss = prop_loss, result <- survival_adapt_fn(hazard_treatment = hazard_treatment, alternative = alternative, h0 = h0, Fn = Fn, hazard_control = hazard_control, cutpoints = cutpoints, Sn = Sn, Qn = Qn, prob_ha = prob_ha, N_impute = N_impute, N_total = N_total, lambda = lambda, lambda_time = lambda_time, N_mcmc = N_mcmc, mc_conf_level = mc_conf_level, interim_look = interim_look, end_of_study = end_of_study, method = method, imputed_final = imputed_final, prior_surv = prior_surv, prior_bin = prior_bin, empty_interval = empty_interval, return_trace = return_trace, bin_method = bin_method, binary_imputation = binary_imputation, block = block, rand_ratio = rand_ratio, prop_loss = prop_loss, prior_surv_final = prior_surv_final, generation_cutpoints = generation_cutpoints, alternative = alternative, h0 = h0, Fn = Fn, rmst_tau = rmst_tau) Sn = Sn, Qn = Qn, prob_ha = prob_ha, N_impute = N_impute, attr(result, "arguments") <- NULL N_mcmc = N_mcmc, mc_conf_level = mc_conf_level, if (inherits(result, "goldilocks_trial")) { method = method, imputed_final = imputed_final, attr(result$summary, "arguments") <- NULL } empty_interval = empty_interval, return_trace = return_trace, list(trial = as.integer(x), result = result) prior_surv_final = prior_surv_final, generation_cutpoints = generation_cutpoints, }, error = function(error) { rmst_tau = rmst_tau) attr(result, "arguments") <- NULL list(trial = as.integer(x), result = NULL, error_class = class(error)[1L], if (inherits(result, "goldilocks_trial")) { message = conditionMessage(error)) }) attr(result$summary, "arguments") <- NULL } } list(trial = as.integer(x), result = result) }, error = function(error) { trial_index <- seq_len(N_trials) list(trial = as.integer(x), result = NULL, error_class = class(error)[1L], trial_results <- switch(backend, sequential = lapply(trial_index, message = conditionMessage(error)) survival_adapt_wrapper), fork = pbmclapply(trial_index, }) survival_adapt_wrapper, mc.cores = workers), psock = { } trial_index <- seq_len(N_trials) active_cluster <- make_sim_cluster(workers) trial_results <- switch(backend, sequential = lapply(trial_index, on.exit(stop_sim_cluster(active_cluster), add = TRUE) survival_adapt_wrapper), fork = pbmclapply(trial_index, initialize_sim_cluster(active_cluster) run_sim_cluster(active_cluster, trial_index, survival_adapt_wrapper) survival_adapt_wrapper, mc.cores = workers), psock = { }) active_cluster <- make_sim_cluster(workers) failed <- vapply(trial_results, function(x) is.null(x$result), on.exit(stop_sim_cluster(active_cluster), add = TRUE) initialize_sim_cluster(active_cluster) logical(1)) failed_results <- trial_results[failed] run_sim_cluster(active_cluster, trial_index, survival_adapt_wrapper) failures <- data.frame(trial = vapply(failed_results, `[[`, integer(1), "trial"), error_class = vapply(failed_results, }) `[[`, character(1), "error_class"), message = vapply(failed_results, failed <- vapply(trial_results, function(x) is.null(x$result), `[[`, character(1), "message"), stringsAsFactors = FALSE) logical(1)) failed_results <- trial_results[failed] if (all(failed)) { failures <- data.frame(trial = vapply(failed_results, `[[`, error <- simpleError(paste0("All ", N_trials, " simulated trials failed. First error: ", integer(1), "trial"), error_class = vapply(failed_results, failures$message[1L])) `[[`, character(1), "error_class"), message = vapply(failed_results, error$failures <- failures `[[`, character(1), "message"), stringsAsFactors = FALSE) class(error) <- c("goldilocks_all_trials_failed", class(error)) if (all(failed)) { stop(error) error <- simpleError(paste0("All ", N_trials, " simulated trials failed. First error: ", } failures$message[1L])) error$failures <- failures successful_trials <- trial_results[!failed] class(error) <- c("goldilocks_all_trials_failed", class(error)) successful_results <- lapply(successful_trials, `[[`, "result") stop(error) if (return_trace) { } sims <- bind_rows(lapply(successful_results, function(x) x$summary)) successful_trials <- trial_results[!failed] traces <- bind_rows(lapply(seq_along(successful_results), successful_results <- lapply(successful_trials, `[[`, "result") function(i) { if (return_trace) { trace <- successful_results[[i]]$trace sims <- bind_rows(lapply(successful_results, function(x) x$summary)) traces <- bind_rows(lapply(seq_along(successful_results), trial <- successful_trials[[i]]$trial function(i) { trace$trial <- rep.int(trial, nrow(trace)) trace[c("trial", setdiff(names(trace), "trial"))] trace <- successful_results[[i]]$trace })) trial <- successful_trials[[i]]$trial out <- list(sims = sims, traces = traces, failures = failures, call = Call) trace$trial <- rep.int(trial, nrow(trace)) trace[c("trial", setdiff(names(trace), "trial"))] } })) else { out <- list(sims = sims, traces = traces, failures = failures, sims <- bind_rows(successful_results) call = Call) out <- list(sims = sims, failures = failures, call = Call) } } else { attr(out$sims, "arguments") <- NULL sims <- bind_rows(successful_results) attr(out, "enrollment_design") <- new_enrollment_design(lambda = lambda, out <- list(sims = sims, failures = failures, call = Call) N_total = N_total, lambda_time = lambda_time, interim_look = interim_look, } end_of_study = end_of_study) attr(out$sims, "arguments") <- NULL attr(out, "decision_design") <- attr(successful_results[[1]], attr(out, "enrollment_design") <- new_enrollment_design(lambda = lambda, "decision_design", exact = TRUE) N_total = N_total, lambda_time = lambda_time, interim_look = interim_look, attr(out, "prior_design") <- attr(successful_results[[1]], end_of_study = end_of_study) "prior_design", exact = TRUE) attr(out, "decision_design") <- attr(successful_results[[1]], attr(out, "rng_metadata") <- rng_metadata "decision_design", exact = TRUE) attr(out, "arguments") <- Arguments attr(out, "prior_design") <- attr(successful_results[[1]], attr(out, "parallel_metadata") <- list(requested_backend = requested_backend, "prior_design", exact = TRUE) backend = backend, selection_reason = execution$reason, attr(out, "rng_metadata") <- rng_metadata requested_ncores = as.integer(ncores), workers = as.integer(workers), attr(out, "arguments") <- Arguments tasks = as.integer(N_trials)) attr(out, "parallel_metadata") <- list(requested_backend = requested_backend, if (nrow(failures) > 0L) { backend = backend, selection_reason = execution$reason, warning(nrow(failures), " of ", N_trials, " simulated trials failed and were excluded. See `result$failures` ", requested_ncores = as.integer(ncores), workers = as.integer(workers), "for details.", call. = FALSE) tasks = as.integer(N_trials)) } if (nrow(failures) > 0L) { return(out) warning(nrow(failures), " of ", N_trials, " simulated trials failed and were excluded. See `result$failures` ", })(cutpoints = c(26, 52), generation_cutpoints = 52, N_total = 1000, "for details.", call. = FALSE) lambda = c(0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6), lambda_time = c(4.33333333333333, } 8.66666666666667, 13, 17.3333333333333, 21.6666666666667, return(out) 26), interim_look = c(400, 500, 600, 700, 800, 900), end_of_study = 69.3333333333333, })(cutpoints = c(26, 52), generation_cutpoints = 52, N_total = 1000, prior_surv = c(1, 144.927536231884, 1, 144.927536231884, lambda = c(0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6), lambda_time = c(4.33333333333333, 1, 285.714285714286), block = 3, rand_ratio = c(control = 1, 8.66666666666667, 13, 17.3333333333333, 21.6666666666667, treatment = 2), prop_loss = 0.1, alternative = "less", h0 = 0, 26), interim_look = c(400, 500, 600, 700, 800, 900), end_of_study = 69.3333333333333, Fn = c(0.01, 0.01, 0.01, 0.01, 0.01, 0.01), Sn = c(1, 0.95, prior_surv = c(1, 144.927536231884, 1, 144.927536231884, 0.95, 0.95, 0.95, 0.95), prob_ha = 0.981, N_impute = 300, 1, 285.714285714286), block = 3, rand_ratio = c(control = 1, mc_conf_level = 0.95, empty_interval = "prior", method = "logrank", treatment = 2), prop_loss = 0.1, alternative = "less", h0 = 0, imputed_final = FALSE, hazard_treatment = c(0.005796, 0.00168 Fn = c(0.01, 0.01, 0.01, 0.01, 0.01, 0.01), Sn = c(1, 0.95, ), hazard_control = c(0.00828, 0.0024), N_trials = 20, ncores = 2, 0.95, 0.95, 0.95, 0.95), prob_ha = 0.981, N_impute = 300, seed = 3425430) mc_conf_level = 0.95, empty_interval = "prior", method = "logrank", imputed_final = FALSE, hazard_treatment = c(0.005796, 0.0016823: ), hazard_control = c(0.00828, 0.0024), N_trials = 20, ncores = 2, do.call(sim_trials, c(anthem_common, list(hazard_treatment = hazard_treatment_target_week, seed = 3425430) hazard_control = hazard_control_week, N_trials = 20, ncores = 2, seed = 3425430)))23: do.call(sim_trials, c(anthem_common, list(hazard_treatment = hazard_treatment_target_week, 24: hazard_control = hazard_control_week, N_trials = 20, ncores = 2, eval(expr, envir) seed = 3425430))) 25: 24: eval(expr, envir)eval(expr, envir) 26: 25: eval(expr, envir)withVisible(eval(expr, envir)) 26: 27: withVisible(eval(expr, envir))withCallingHandlers(code, error = function (e) rlang::entrace(e), message = function (cnd) 27: {withCallingHandlers(code, error = function (e) watcher$capture_plot_and_output()rlang::entrace(e), message = function (cnd) if (on_message$capture) {{ watcher$push(cnd) watcher$capture_plot_and_output() } if (on_message$capture) { if (on_message$silence) { watcher$push(cnd) invokeRestart("muffleMessage") } } if (on_message$silence) {}, warning = function (cnd) invokeRestart("muffleMessage"){ } if (getOption("warn") >= 2 || getOption("warn") < 0) {}, warning = function (cnd) return(){ } if (getOption("warn") >= 2 || getOption("warn") < 0) { watcher$capture_plot_and_output() return() if (on_warning$capture) { } cnd <- sanitize_call(cnd) watcher$capture_plot_and_output() watcher$push(cnd) if (on_warning$capture) { } cnd <- sanitize_call(cnd) if (on_warning$silence) { watcher$push(cnd) invokeRestart("muffleWarning") } } if (on_warning$silence) {}, error = function (cnd) invokeRestart("muffleWarning"){ } watcher$capture_plot_and_output() cnd <- sanitize_call(cnd) watcher$push(cnd)}, error = function (cnd) switch(on_error, continue = invokeRestart("eval_continue"), stop = invokeRestart("eval_stop"), error = NULL){}) watcher$capture_plot_and_output() cnd <- sanitize_call(cnd)28: watcher$push(cnd)eval(call) switch(on_error, continue = invokeRestart("eval_continue"), stop = invokeRestart("eval_stop"), error = NULL)29: })eval(call) 28: 30: eval(call)with_handlers({ for (expr in tle$exprs) {29: ev <- withVisible(eval(expr, envir))eval(call) watcher$capture_plot_and_output() watcher$print_value(ev$value, ev$visible, envir)30: }with_handlers({ TRUE for (expr in tle$exprs) {}, handlers) ev <- withVisible(eval(expr, envir)) watcher$capture_plot_and_output()31: watcher$print_value(ev$value, ev$visible, envir)doWithOneRestart(return(expr), restart) } TRUE32: }, handlers)withOneRestart(expr, restarts[[1L]]) 31: 33: doWithOneRestart(return(expr), restart)withRestartList(expr, restarts[-nr]) 32: 34: withOneRestart(expr, restarts[[1L]])doWithOneRestart(return(expr), restart) 33: 35: withRestartList(expr, restarts[-nr])withOneRestart(withRestartList(expr, restarts[-nr]), restarts[[nr]]) 34: 36: withRestartList(expr, restarts)doWithOneRestart(return(expr), restart) 37: 35: withRestarts(with_handlers({withOneRestart(withRestartList(expr, restarts[-nr]), restarts[[nr]]) for (expr in tle$exprs) { ev <- withVisible(eval(expr, envir))36: withRestartList(expr, restarts) watcher$capture_plot_and_output() watcher$print_value(ev$value, ev$visible, envir)37: }withRestarts(with_handlers({ TRUE for (expr in tle$exprs) {}, handlers), eval_continue = function() TRUE, eval_stop = function() FALSE) ev <- withVisible(eval(expr, envir)) watcher$capture_plot_and_output()38: watcher$print_value(ev$value, ev$visible, envir)evaluate::evaluate(...) } TRUE39: }, handlers), eval_continue = function() TRUE, eval_stop = function() FALSE)evaluate(code, envir = env, new_device = FALSE, keep_warning = if (is.numeric(options$warning)) TRUE else options$warning, keep_message = if (is.numeric(options$message)) TRUE else options$message, 38: stop_on_error = if (is.numeric(options$error)) options$error else {evaluate::evaluate(...) if (options$error && options$include) 0L39: else 2Levaluate(code, envir = env, new_device = FALSE, keep_warning = if (is.numeric(options$warning)) TRUE else options$warning, }, output_handler = knit_handlers(options$render, options)) keep_message = if (is.numeric(options$message)) TRUE else options$message, stop_on_error = if (is.numeric(options$error)) options$error else {40: if (options$error && options$include) in_dir(input_dir(), expr) 0L else 2L41: }, output_handler = knit_handlers(options$render, options))in_input_dir(evaluate(code, envir = env, new_device = FALSE, keep_warning = if (is.numeric(options$warning)) TRUE else options$warning, 40: keep_message = if (is.numeric(options$message)) TRUE else options$message, in_dir(input_dir(), expr) stop_on_error = if (is.numeric(options$error)) options$error else { if (options$error && options$include) 41: 0Lin_input_dir(evaluate(code, envir = env, new_device = FALSE, else 2L keep_warning = if (is.numeric(options$warning)) TRUE else options$warning, }, output_handler = knit_handlers(options$render, options))) keep_message = if (is.numeric(options$message)) TRUE else options$message, stop_on_error = if (is.numeric(options$error)) options$error else {42: if (options$error && options$include) eng_r(options) 0L else 2L43: }, output_handler = knit_handlers(options$render, options)))block_exec(params) 42: eng_r(options)44: call_block(x)43: block_exec(params)45: process_group(group)44: call_block(x)46: withCallingHandlers(if (tangle) process_tangle(group) else process_group(group), 45: error = function(e) {process_group(group) if (progress && is.function(pb$interrupt)) pb$interrupt()46: if (is_R_CMD_build() || is_R_CMD_check()) withCallingHandlers(if (tangle) process_tangle(group) else process_group(group), error <<- format(e) error = function(e) { }) if (progress && is.function(pb$interrupt)) pb$interrupt()47: if (is_R_CMD_build() || is_R_CMD_check()) with_options(withCallingHandlers(if (tangle) process_tangle(group) else process_group(group), error <<- format(e) error = function(e) { }) if (progress && is.function(pb$interrupt)) pb$interrupt()47: if (is_R_CMD_build() || is_R_CMD_check()) with_options(withCallingHandlers(if (tangle) process_tangle(group) else process_group(group), error <<- format(e) error = function(e) { }), list(rlang_trace_top_env = knit_global())) if (progress && is.function(pb$interrupt)) pb$interrupt()48: if (is_R_CMD_build() || is_R_CMD_check()) xfun:::handle_error(with_options(withCallingHandlers(if (tangle) process_tangle(group) else process_group(group), error <<- format(e) error = function(e) { }), list(rlang_trace_top_env = knit_global())) if (progress && is.function(pb$interrupt)) pb$interrupt()48: if (is_R_CMD_build() || is_R_CMD_check()) xfun:::handle_error(with_options(withCallingHandlers(if (tangle) process_tangle(group) else process_group(group), error <<- format(e) error = function(e) { }), list(rlang_trace_top_env = knit_global())), function(loc) { if (progress && is.function(pb$interrupt)) setwd(wd) pb$interrupt() write_utf8(res, output %n% stdout()) if (is_R_CMD_build() || is_R_CMD_check()) paste0("\nQuitting from ", loc, if (!is.null(error)) error <<- format(e) paste0("\n", rule(), error, "\n", rule())) }), list(rlang_trace_top_env = knit_global())), function(loc) {}, if (labels[i] != "") sprintf(" [%s]", labels[i]), get_loc) setwd(wd) write_utf8(res, output %n% stdout())49: paste0("\nQuitting from ", loc, if (!is.null(error)) process_file(text, output) paste0("\n", rule(), error, "\n", rule())) }, if (labels[i] != "") sprintf(" [%s]", labels[i]), get_loc)50: knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)49: 51: process_file(text, output)rmarkdown::render(file, encoding = encoding, quiet = quiet, envir = globalenv(), output_dir = getwd(), ...)50: knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)52: vweave_rmarkdown(...)51: rmarkdown::render(file, encoding = encoding, quiet = quiet, envir = globalenv(), 53: output_dir = getwd(), ...)engine$weave(file, quiet = quiet, encoding = enc) 52: 54: vweave_rmarkdown(...)doTryCatch(return(expr), name, parentenv, handler) 53: 55: engine$weave(file, quiet = quiet, encoding = enc) tryCatchOne(expr, names, parentenv, handlers[[1L]])54: doTryCatch(return(expr), name, parentenv, handler)56: tryCatchList(expr, classes, parentenv, handlers)55: tryCatchOne(expr, names, parentenv, handlers[[1L]])57: tryCatch({56: engine$weave(file, quiet = quiet, encoding = enc)tryCatchList(expr, classes, parentenv, handlers) setwd(startdir) output <- find_vignette_product(name, by = "weave", engine = engine)57: if (!have.makefile && vignette_is_tex(output)) {tryCatch({ texi2pdf(file = output, clean = FALSE, quiet = quiet) engine$weave(file, quiet = quiet, encoding = enc) output <- find_vignette_product(name, by = "texi2pdf", setwd(startdir) engine = engine) output <- find_vignette_product(name, by = "weave", engine = engine) } if (!have.makefile && vignette_is_tex(output)) {}, error = function(e) { texi2pdf(file = output, clean = FALSE, quiet = quiet) OK <<- FALSE output <- find_vignette_product(name, by = "texi2pdf", message(gettextf("Error: processing vignette '%s' failed with diagnostics:\n%s", engine = engine) file, conditionMessage(e))) }})}, error = function(e) { OK <<- FALSE58: message(gettextf("Error: processing vignette '%s' failed with diagnostics:\n%s", tools:::.buildOneVignette("anthem-hfref.Rmd", "/Volumes/Builds/packages/big-sur-arm64/results/4.5/goldilocks.Rcheck/vign_test/goldilocks", file, conditionMessage(e))) TRUE, TRUE, "anthem-hfref", "UTF-8", "/Volumes/Temp/tmp/RtmpwR6fcO/file8c9f6b91810e.rds")}) An irrecoverable exception occurred. R is aborting now ... 58: tools:::.buildOneVignette("anthem-hfref.Rmd", "/Volumes/Builds/packages/big-sur-arm64/results/4.5/goldilocks.Rcheck/vign_test/goldilocks", TRUE, TRUE, "anthem-hfref", "UTF-8", "/Volumes/Temp/tmp/RtmpwR6fcO/file8c9f6b91810e.rds") An irrecoverable exception occurred. R is aborting now ... Quitting from anthem-hfref.Rmd:432-482 [small-operating-characteristics] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ <error/rlang_error> Error in `vapply()`: ! values must be length 1, but FUN(X[[1]]) result is length 0 --- Backtrace: ▆ 1. ├─base::do.call(...) 2. └─goldilocks (local) `<fn>`(...) 3. ├─base::data.frame(...) 4. └─base::vapply(failed_results, `[[`, integer(1), "trial") ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Error: processing vignette 'anthem-hfref.Rmd' failed with diagnostics: values must be length 1, but FUN(X[[1]]) result is length 0 --- failed re-building ‘anthem-hfref.Rmd’ --- re-building ‘architecture.Rmd’ using rmarkdown --- finished re-building ‘architecture.Rmd’ --- re-building ‘bayes-piecewise.Rmd’ using rmarkdown --- finished re-building ‘bayes-piecewise.Rmd’ --- re-building ‘bayesian-binary.Rmd’ using rmarkdown --- finished re-building ‘bayesian-binary.Rmd’ --- re-building ‘calibrating-prob-ha.Rmd’ using rmarkdown 2026-10-08 16:56:55.890 R[38234:358897] XType: Using static font registry. --- finished re-building ‘calibrating-prob-ha.Rmd’ --- re-building ‘decision-traces.Rmd’ using rmarkdown 2026-10-08 16:56:57.654 R[38984:359965] XType: Using static font registry. --- finished re-building ‘decision-traces.Rmd’ --- re-building ‘frequentist-binary.Rmd’ using rmarkdown --- finished re-building ‘frequentist-binary.Rmd’ --- re-building ‘interim-data.Rmd’ using rmarkdown --- finished re-building ‘interim-data.Rmd’ --- re-building ‘rmst.Rmd’ using rmarkdown --- finished re-building ‘rmst.Rmd’ --- re-building ‘single-arm.Rmd’ using rmarkdown --- finished re-building ‘single-arm.Rmd’ --- re-building ‘technical-methods.Rmd’ using rmarkdown --- finished re-building ‘technical-methods.Rmd’ --- re-building ‘thermocool-af.Rmd’ using rmarkdown 2026-10-08 16:57:08.522 R[40260:362115] XType: Using static font registry. --- finished re-building ‘thermocool-af.Rmd’ --- re-building ‘two-arm.Rmd’ using rmarkdown 2026-10-08 16:57:10.341 R[41369:363792] XType: Using static font registry. --- finished re-building ‘two-arm.Rmd’ SUMMARY: processing the following files failed: ‘advent.Rmd’ ‘anthem-hfref.Rmd’ Error: Vignette re-building failed. Execution halted Flavor: r-oldrel-macos-arm64