CRAN Package Check Results for Package goldilocks

Last updated on 2026-11-03 04:54:38 CET.

Flavor Version Tinstall Tcheck Ttotal Status Flags
r-devel-linux-x86_64-debian-clang 1.0.0 25.71 540.33 566.04 OK
r-devel-linux-x86_64-debian-gcc 1.0.0 19.62 362.29 381.91 OK
r-devel-linux-x86_64-fedora-clang 1.0.0 21.00 369.17 390.17 OK
r-devel-linux-x86_64-fedora-gcc 1.0.0 20.00 364.34 384.34 OK
r-devel-windows-x86_64 1.0.0 44.00 514.00 558.00 OK
r-patched-linux-x86_64 1.0.0 25.00 520.70 545.70 OK
r-release-linux-x86_64 1.0.0 25.40 524.19 549.59 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 44.00 428.00 472.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 49.00 573.00 622.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/RtmpZ7iG4P/filef02060ea84af.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/RtmpZ7iG4P/filef02060ea84af.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-11-03 14:47:51.318 R[62291:448687] XType: Using static font registry. *** caught segfault *** address 0x110, cause 'invalid permissions' *** caught segfault *** address 0x110, cause 'invalid permissions' Traceback: 1: impute_predictive_arm(time = data_in$time[current_treatment], 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, values = impute_predictive_arm(time = data_in$time[current_treatment], 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, 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: Traceback: 1: tryCatchOne(expr, names, parentenv, handlers[[1L]]) impute_predictive_arm(time = data_in$time[current_treatment], hazards = treatment_hazards, random_input = random_inputs$current_treatment, 8: end_of_study = end_of_study, cutpoints = cutpoints, binary_imputation = binary_imputation)tryCatchList(expr, classes, parentenv, handlers) 9: 2: fill_predictive_imputations(imputations = current, rows = current_treatment, tryCatch({ if (!is.null(trial_streams)) { assign(".Random.seed", trial_streams[[x]], envir = .GlobalEnv) values = impute_predictive_arm(time = data_in$time[current_treatment], hazards = treatment_hazards, random_input = random_inputs$current_treatment, } end_of_study = end_of_study, cutpoints = cutpoints, binary_imputation = binary_imputation)) result <- survival_adapt_fn(hazard_treatment = hazard_treatment, 3: hazard_control = hazard_control, cutpoints = cutpoints, impute_predictive_draws(data_in = data_interim, hazards = post_lambda, N_total = N_total, lambda = lambda, lambda_time = lambda_time, end_of_study = end_of_study, cutpoints = cutpoints, single_arm = single_arm, binary_imputation = predictive_binary_imputation, check_futility = check_futility) 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, 4: rand_ratio = rand_ratio, prop_loss = prop_loss, alternative = alternative, evaluate_interim_decision(data_interim = data_interim, look = i, h0 = h0, Fn = Fn, Sn = Sn, Qn = Qn, prob_ha = prob_ha, planned_N = analysis_at_enrollnumber[i], calendar_time = look_time, active_followup = active_followup_at(data_total, look_time), N_impute = N_impute, N_mcmc = N_mcmc, mc_conf_level = mc_conf_level, 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, method = method, imputed_final = imputed_final, empty_interval = empty_interval, prior_bin = prior_bin, bin_method = bin_method, alternative = alternative, return_trace = return_trace, prior_surv_final = prior_surv_final, h0 = h0, Fn = Fn[i], Sn = Sn[i], 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, empty_interval = empty_interval, attr(result, "arguments") <- NULL method = method, binary_imputation = binary_imputation, check_futility = check_futility, if (inherits(result, "goldilocks_trial")) { Qn = Qn[i]) attr(result$summary, "arguments") <- NULL 5: }survival_adapt_fn(hazard_treatment = hazard_treatment, hazard_control = hazard_control, list(trial = as.integer(x), result = result) cutpoints = cutpoints, N_total = N_total, lambda = lambda, }, error = function(error) { list(trial = as.integer(x), result = NULL, error_class = class(error)[1L], 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, message = conditionMessage(error)) 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, 10: imputed_final = imputed_final, empty_interval = empty_interval, FUN(X[[i]], ...) return_trace = return_trace, prior_surv_final = prior_surv_final, generation_cutpoints = generation_cutpoints, rmst_tau = rmst_tau)11: lapply(X = S, FUN = FUN, ...) 6: doTryCatch(return(expr), name, parentenv, handler) 12: doTryCatch(return(expr), name, parentenv, handler) 7: tryCatchOne(expr, names, parentenv, handlers[[1L]])13: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 8: tryCatchList(expr, classes, parentenv, handlers)14: tryCatchList(expr, classes, parentenv, handlers) 9: 15: tryCatch({tryCatch(expr, error = function(e) { if (!is.null(trial_streams)) { call <- conditionCall(e) assign(".Random.seed", trial_streams[[x]], envir = .GlobalEnv) if (!is.null(call)) { } if (identical(call[[1L]], quote(doTryCatch))) result <- survival_adapt_fn(hazard_treatment = hazard_treatment, call <- sys.call(-4L) hazard_control = hazard_control, cutpoints = cutpoints, dcall <- deparse(call, nlines = 1L) N_total = N_total, lambda = lambda, lambda_time = lambda_time, prefix <- paste("Error in", dcall, ": ") interim_look = interim_look, end_of_study = end_of_study, prior_surv = prior_surv, prior_bin = prior_bin, bin_method = bin_method, LONG <- 75L binary_imputation = binary_imputation, block = block, rand_ratio = rand_ratio, prop_loss = prop_loss, alternative = alternative, sm <- strsplit(conditionMessage(e), "\n")[[1L]] h0 = h0, Fn = Fn, Sn = Sn, Qn = Qn, prob_ha = prob_ha, w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w") if (is.na(w)) N_impute = N_impute, N_mcmc = N_mcmc, mc_conf_level = mc_conf_level, w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], method = method, imputed_final = imputed_final, empty_interval = empty_interval, type = "b") return_trace = return_trace, prior_surv_final = prior_surv_final, if (w > LONG) generation_cutpoints = generation_cutpoints, rmst_tau = rmst_tau) attr(result, "arguments") <- NULL prefix <- paste0(prefix, "\n ") } if (inherits(result, "goldilocks_trial")) { else prefix <- "Error : " attr(result$summary, "arguments") <- NULL msg <- paste0(prefix, conditionMessage(e), "\n") .Internal(seterrmessage(msg[1L])) } list(trial = as.integer(x), result = result) if (!silent && isTRUE(getOption("show.error.messages"))) {}, error = function(error) { cat(msg, file = outFile) .Internal(printDeferredWarnings()) list(trial = as.integer(x), result = NULL, error_class = class(error)[1L], message = conditionMessage(error)) }}) invisible(structure(msg, class = "try-error", condition = e)) })10: 16: FUN(X[[i]], ...) try(lapply(X = S, FUN = FUN, ...), silent = TRUE)11: lapply(X = S, FUN = FUN, ...)17: sendMaster(try(lapply(X = S, FUN = FUN, ...), silent = TRUE))12: doTryCatch(return(expr), name, parentenv, handler)18: FUN(X[[i]], ...) 13: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 19: 14: lapply(seq_len(cores), inner.do)tryCatchList(expr, classes, parentenv, handlers) 20: 15: tryCatch(expr, error = function(e) {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) call <- conditionCall(e) if (!is.null(call)) { if (identical(call[[1L]], quote(doTryCatch))) 21: call <- sys.call(-4L)pbmclapply(trial_index, survival_adapt_wrapper, mc.cores = workers) dcall <- deparse(call, nlines = 1L)22: prefix <- paste("Error in", dcall, ": ") LONG <- 75L(function (hazard_treatment, hazard_control = NULL, cutpoints = NULL, N_total, lambda = 0.3, lambda_time = NULL, interim_look = NULL, sm <- strsplit(conditionMessage(e), "\n")[[1L]] end_of_study, prior_surv = c(0.1, 0.1), prior_bin = c(1, w <- 14L + nchar(dcall, type = "w") + nchar(sm[1L], type = "w") 1), bin_method = "mc", block = 2, rand_ratio = c(control = 1, treatment = 1), prop_loss = 0, alternative = "greater", if (is.na(w)) w <- 14L + nchar(dcall, type = "b") + nchar(sm[1L], 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", type = "b") imputed_final = FALSE, empty_interval = c("prior", "propagate", if (w > LONG) "error"), return_trace = FALSE, ncores = 1L, backend = c("auto", "fork", "psock", "sequential"), seed = NULL, binary_imputation = c("event-time", prefix <- paste0(prefix, "\n ") "bernoulli"), prior_surv_final = prior_surv, generation_cutpoints = cutpoints, } Qn = 1, rmst_tau = end_of_study) else prefix <- "Error : "{ msg <- paste0(prefix, conditionMessage(e), "\n") .Internal(seterrmessage(msg[1L])) Call <- match.call() Arguments <- capture_arguments(sim_trials, environment()) if (!silent && isTRUE(getOption("show.error.messages"))) { method <- normalize_analysis_method(method) cat(msg, file = outFile) .Internal(printDeferredWarnings()) Arguments$method <- method } empty_interval <- match.arg(empty_interval) invisible(structure(msg, class = "try-error", condition = e)) binary_imputation <- match.arg(binary_imputation)}) backend <- match.arg(backend) Arguments$empty_interval <- empty_interval16: try(lapply(X = S, FUN = FUN, ...), silent = TRUE) Arguments$binary_imputation <- binary_imputation 17: Arguments$backend <- backendsendMaster(try(lapply(X = S, FUN = FUN, ...), silent = TRUE)) requested_backend <- backend18: caller_rng_kind <- RNGkind() validate_positive_integer_scalar(N_trials, "N_trials")FUN(X[[i]], ...) single_arm <- is.null(hazard_control) if (!single_arm) { rand_ratio <- validate_randomization_args(N_total, block, rand_ratio, allocation_name = "rand_ratio")19: lapply(seq_len(cores), inner.do) Arguments$rand_ratio <- rand_ratio }20: prop_loss <- normalize_prop_loss(prop_loss, single_arm = single_arm)mclapply(X, FUN, ..., mc.cores = mc.cores, mc.preschedule = mc.preschedule, Arguments$prop_loss <- prop_loss mc.set.seed = mc.set.seed, mc.cleanup = mc.cleanup, mc.allow.recursive = mc.allow.recursive) validate_logical_scalar(return_trace, "return_trace") validate_positive_integer_scalar(N_impute, "N_impute") 21: validate_positive_integer_scalar(N_mcmc, "N_mcmc")pbmclapply(trial_index, survival_adapt_wrapper, mc.cores = workers) validate_single_probability(mc_conf_level, "mc_conf_level", upper_open = TRUE)22: if (mc_conf_level <= 0.5) {(function (hazard_treatment, hazard_control = NULL, cutpoints = NULL, stop("'mc_conf_level' must be greater than 0.5 and less than 1") 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, validate_final_imputation(method, imputed_final, has_missing_outcomes = any(prop_loss > 1), bin_method = "mc", block = 2, rand_ratio = c(control = 1, 0), N_impute = N_impute) treatment = 1), prop_loss = 0, alternative = "greater", if (identical(method, "rmst")) { h0 = 0, Fn = 0.05, Sn = 0.9, prob_ha = 0.95, N_impute = 500, validate_endpoint_time(end_of_study, cutpoints, "end_of_study") N_mcmc = 1000, mc_conf_level = 0.95, N_trials = 10, method = "logrank", validate_rmst_args(rmst_tau, end_of_study, h0) imputed_final = FALSE, empty_interval = c("prior", "propagate", validate_analysis_configuration(method, alternative, "error"), return_trace = FALSE, ncores = 1L, backend = c("auto", is.null(hazard_control), imputed_final) "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) validate_positive_integer_scalar(ncores, "ncores") execution <- resolve_sim_execution(backend = backend, ncores = ncores, { N_trials = N_trials) Call <- match.call() Arguments <- capture_arguments(sim_trials, environment()) backend <- execution$backend method <- normalize_analysis_method(method) workers <- execution$workers Arguments$method <- method stream_seed <- NULL empty_interval <- match.arg(empty_interval) binary_imputation <- match.arg(binary_imputation) if (!is.null(seed)) { backend <- match.arg(backend) if (length(seed) != 1 || !is.numeric(seed) || is.na(seed) || Arguments$empty_interval <- empty_interval !is.finite(seed) || seed != floor(seed)) { Arguments$binary_imputation <- binary_imputation stop("'seed' must be NULL or a single integer value") Arguments$backend <- backend } requested_backend <- backend old_kind <- RNGkind() caller_rng_kind <- RNGkind() old_seed_exists <- exists(".Random.seed", envir = .GlobalEnv, validate_positive_integer_scalar(N_trials, "N_trials") inherits = FALSE) if (old_seed_exists) { single_arm <- is.null(hazard_control) old_seed <- get(".Random.seed", envir = .GlobalEnv, inherits = FALSE) if (!single_arm) { } rand_ratio <- validate_randomization_args(N_total, block, on.exit({ rand_ratio, allocation_name = "rand_ratio") do.call(RNGkind, as.list(old_kind)) if (old_seed_exists) { Arguments$rand_ratio <- rand_ratio assign(".Random.seed", old_seed, envir = .GlobalEnv) } } else if (exists(".Random.seed", envir = .GlobalEnv, inherits = FALSE)) { prop_loss <- normalize_prop_loss(prop_loss, single_arm = single_arm) rm(".Random.seed", envir = .GlobalEnv) } Arguments$prop_loss <- prop_loss }, add = TRUE) stream_seed <- seed validate_logical_scalar(return_trace, "return_trace") trial_streams <- make_rng_streams(stream_seed, N_trials) validate_positive_integer_scalar(N_impute, "N_impute") } validate_positive_integer_scalar(N_mcmc, "N_mcmc") else if (backend == "psock") { stream_seed <- sample.int(.Machine$integer.max - 1L, validate_single_probability(mc_conf_level, "mc_conf_level", size = 1L) trial_streams <- make_rng_streams(stream_seed, N_trials) upper_open = TRUE) } if (mc_conf_level <= 0.5) { else { stop("'mc_conf_level' must be greater than 0.5 and less than 1") trial_streams <- NULL } } rng_metadata <- list(caller_kind = caller_rng_kind, stream_kind = if (is.null(trial_streams)) { validate_final_imputation(method, imputed_final, has_missing_outcomes = any(prop_loss > caller_rng_kind[1] } else { 0), N_impute = N_impute) "L'Ecuyer-CMRG" if (identical(method, "rmst")) { }, seed_policy = if (!is.null(seed)) { validate_endpoint_time(end_of_study, cutpoints, "end_of_study") "explicit_preserve_caller" validate_rmst_args(rmst_tau, end_of_study, h0) } else if (backend == "psock") { validate_analysis_configuration(method, alternative, is.null(hazard_control), imputed_final) "caller_derived_psock" } validate_positive_integer_scalar(ncores, "ncores") } else { execution <- resolve_sim_execution(backend = backend, ncores = ncores, N_trials = N_trials) "caller_state" backend <- execution$backend workers <- execution$workers }, backend = backend, ncores = as.integer(workers), requested_ncores = as.integer(ncores), stream_seed <- NULL stream_seed = stream_seed) if (!is.null(seed)) { if (length(seed) != 1 || !is.numeric(seed) || is.na(seed) || survival_adapt_fn <- if (backend == "psock") { make_psock_callable("survival_adapt") !is.finite(seed) || seed != floor(seed)) { stop("'seed' must be NULL or a single integer value") } else { } survival_adapt old_kind <- RNGkind() old_seed_exists <- exists(".Random.seed", envir = .GlobalEnv, } survival_adapt_wrapper <- function(x) { inherits = FALSE) tryCatch({ if (old_seed_exists) { if (!is.null(trial_streams)) { assign(".Random.seed", trial_streams[[x]], envir = .GlobalEnv) old_seed <- get(".Random.seed", envir = .GlobalEnv, } inherits = FALSE) result <- survival_adapt_fn(hazard_treatment = hazard_treatment, } hazard_control = hazard_control, cutpoints = cutpoints, on.exit({ N_total = N_total, lambda = lambda, lambda_time = lambda_time, do.call(RNGkind, as.list(old_kind)) interim_look = interim_look, end_of_study = end_of_study, if (old_seed_exists) { prior_surv = prior_surv, prior_bin = prior_bin, bin_method = bin_method, binary_imputation = binary_imputation, assign(".Random.seed", old_seed, envir = .GlobalEnv) block = block, rand_ratio = rand_ratio, prop_loss = prop_loss, } else if (exists(".Random.seed", envir = .GlobalEnv, alternative = alternative, h0 = h0, Fn = Fn, inherits = FALSE)) { Sn = Sn, Qn = Qn, prob_ha = prob_ha, N_impute = N_impute, rm(".Random.seed", envir = .GlobalEnv) N_mcmc = N_mcmc, mc_conf_level = mc_conf_level, } method = method, imputed_final = imputed_final, }, add = TRUE) empty_interval = empty_interval, return_trace = return_trace, stream_seed <- seed prior_surv_final = prior_surv_final, generation_cutpoints = generation_cutpoints, trial_streams <- make_rng_streams(stream_seed, N_trials) } rmst_tau = rmst_tau) else if (backend == "psock") { attr(result, "arguments") <- NULL stream_seed <- sample.int(.Machine$integer.max - 1L, if (inherits(result, "goldilocks_trial")) { size = 1L) attr(result$summary, "arguments") <- NULL trial_streams <- make_rng_streams(stream_seed, N_trials) } } list(trial = as.integer(x), result = result) else { }, error = function(error) { trial_streams <- NULL list(trial = as.integer(x), result = NULL, error_class = class(error)[1L], } message = conditionMessage(error)) rng_metadata <- list(caller_kind = caller_rng_kind, stream_kind = if (is.null(trial_streams)) { }) caller_rng_kind[1] } } else { trial_index <- seq_len(N_trials) "L'Ecuyer-CMRG" trial_results <- switch(backend, sequential = lapply(trial_index, }, seed_policy = if (!is.null(seed)) { survival_adapt_wrapper), fork = pbmclapply(trial_index, "explicit_preserve_caller" survival_adapt_wrapper, mc.cores = workers), psock = { } else if (backend == "psock") { active_cluster <- make_sim_cluster(workers) "caller_derived_psock" on.exit(stop_sim_cluster(active_cluster), add = TRUE) } else { initialize_sim_cluster(active_cluster) "caller_state" run_sim_cluster(active_cluster, trial_index, survival_adapt_wrapper) }, backend = backend, ncores = as.integer(workers), requested_ncores = as.integer(ncores), }) stream_seed = stream_seed) failed <- vapply(trial_results, function(x) is.null(x$result), survival_adapt_fn <- if (backend == "psock") { logical(1)) make_psock_callable("survival_adapt") failed_results <- trial_results[failed] } failures <- data.frame(trial = vapply(failed_results, `[[`, else { integer(1), "trial"), error_class = vapply(failed_results, `[[`, character(1), "error_class"), message = vapply(failed_results, survival_adapt `[[`, character(1), "message"), stringsAsFactors = FALSE) } if (all(failed)) { survival_adapt_wrapper <- function(x) { error <- simpleError(paste0("All ", N_trials, " simulated trials failed. First error: ", tryCatch({ failures$message[1L])) if (!is.null(trial_streams)) { error$failures <- failures assign(".Random.seed", trial_streams[[x]], envir = .GlobalEnv) class(error) <- c("goldilocks_all_trials_failed", class(error)) } stop(error) result <- survival_adapt_fn(hazard_treatment = hazard_treatment, } hazard_control = hazard_control, cutpoints = cutpoints, successful_trials <- trial_results[!failed] N_total = N_total, lambda = lambda, lambda_time = lambda_time, successful_results <- lapply(successful_trials, `[[`, "result") interim_look = interim_look, end_of_study = end_of_study, if (return_trace) { prior_surv = prior_surv, prior_bin = prior_bin, sims <- bind_rows(lapply(successful_results, function(x) x$summary)) bin_method = bin_method, binary_imputation = binary_imputation, traces <- bind_rows(lapply(seq_along(successful_results), block = block, rand_ratio = rand_ratio, prop_loss = prop_loss, function(i) { alternative = alternative, h0 = h0, Fn = Fn, trace <- successful_results[[i]]$trace Sn = Sn, Qn = Qn, prob_ha = prob_ha, N_impute = N_impute, trial <- successful_trials[[i]]$trial N_mcmc = N_mcmc, mc_conf_level = mc_conf_level, trace$trial <- rep.int(trial, nrow(trace)) method = method, imputed_final = imputed_final, trace[c("trial", setdiff(names(trace), "trial"))] empty_interval = empty_interval, return_trace = return_trace, })) prior_surv_final = prior_surv_final, generation_cutpoints = generation_cutpoints, out <- list(sims = sims, traces = traces, failures = failures, rmst_tau = rmst_tau) attr(result, "arguments") <- NULL call = Call) if (inherits(result, "goldilocks_trial")) { } attr(result$summary, "arguments") <- NULL else { } sims <- bind_rows(successful_results) list(trial = as.integer(x), result = result) out <- list(sims = sims, failures = failures, call = Call) }, error = function(error) { } list(trial = as.integer(x), result = NULL, error_class = class(error)[1L], attr(out$sims, "arguments") <- NULL message = conditionMessage(error)) 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) trial_index <- seq_len(N_trials) attr(out, "decision_design") <- attr(successful_results[[1]], trial_results <- switch(backend, sequential = lapply(trial_index, "decision_design", exact = TRUE) survival_adapt_wrapper), fork = pbmclapply(trial_index, attr(out, "prior_design") <- attr(successful_results[[1]], survival_adapt_wrapper, mc.cores = workers), psock = { "prior_design", exact = TRUE) active_cluster <- make_sim_cluster(workers) attr(out, "rng_metadata") <- rng_metadata on.exit(stop_sim_cluster(active_cluster), add = TRUE) attr(out, "arguments") <- Arguments initialize_sim_cluster(active_cluster) attr(out, "parallel_metadata") <- list(requested_backend = requested_backend, run_sim_cluster(active_cluster, trial_index, survival_adapt_wrapper) backend = backend, selection_reason = execution$reason, }) requested_ncores = as.integer(ncores), workers = as.integer(workers), tasks = as.integer(N_trials)) failed <- vapply(trial_results, function(x) is.null(x$result), if (nrow(failures) > 0L) { logical(1)) warning(nrow(failures), " of ", N_trials, " simulated trials failed and were excluded. See `result$failures` ", failed_results <- trial_results[failed] "for details.", call. = FALSE) failures <- data.frame(trial = vapply(failed_results, `[[`, } integer(1), "trial"), error_class = vapply(failed_results, return(out) `[[`, character(1), "error_class"), message = vapply(failed_results, })(cutpoints = c(26, 52), generation_cutpoints = 52, N_total = 1000, `[[`, character(1), "message"), stringsAsFactors = FALSE) lambda = c(0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6), lambda_time = c(4.33333333333333, if (all(failed)) { 8.66666666666667, 13, 17.3333333333333, 21.6666666666667, error <- simpleError(paste0("All ", N_trials, " simulated trials failed. First error: ", 26), interim_look = c(400, 500, 600, 700, 800, 900), end_of_study = 69.3333333333333, prior_surv = c(1, 144.927536231884, 1, 144.927536231884, failures$message[1L])) 1, 285.714285714286), block = 3, rand_ratio = c(control = 1, error$failures <- failures treatment = 2), prop_loss = 0.1, alternative = "less", h0 = 0, class(error) <- c("goldilocks_all_trials_failed", class(error)) Fn = c(0.01, 0.01, 0.01, 0.01, 0.01, 0.01), Sn = c(1, 0.95, stop(error) 0.95, 0.95, 0.95, 0.95), prob_ha = 0.981, N_impute = 300, } mc_conf_level = 0.95, empty_interval = "prior", method = "logrank", successful_trials <- trial_results[!failed] imputed_final = FALSE, hazard_treatment = c(0.005796, 0.00168 ), hazard_control = c(0.00828, 0.0024), N_trials = 20, ncores = 2, successful_results <- lapply(successful_trials, `[[`, "result") seed = 3425430) if (return_trace) { sims <- bind_rows(lapply(successful_results, function(x) x$summary))23: traces <- bind_rows(lapply(seq_along(successful_results), do.call(sim_trials, c(anthem_common, list(hazard_treatment = hazard_treatment_target_week, function(i) { hazard_control = hazard_control_week, N_trials = 20, ncores = 2, trace <- successful_results[[i]]$trace seed = 3425430))) trial <- successful_trials[[i]]$trial trace$trial <- rep.int(trial, nrow(trace))24: trace[c("trial", setdiff(names(trace), "trial"))]eval(expr, envir) }))25: out <- list(sims = sims, traces = traces, failures = failures, eval(expr, envir) call = Call)26: }withVisible(eval(expr, envir)) else { sims <- bind_rows(successful_results)27: out <- list(sims = sims, failures = failures, call = Call)withCallingHandlers(code, error = function (e) }rlang::entrace(e), message = function (cnd) attr(out$sims, "arguments") <- NULL{ watcher$capture_plot_and_output() attr(out, "enrollment_design") <- new_enrollment_design(lambda = lambda, if (on_message$capture) { N_total = N_total, lambda_time = lambda_time, interim_look = interim_look, watcher$push(cnd) end_of_study = end_of_study) } attr(out, "decision_design") <- attr(successful_results[[1]], if (on_message$silence) { "decision_design", exact = TRUE) invokeRestart("muffleMessage") attr(out, "prior_design") <- attr(successful_results[[1]], } "prior_design", exact = TRUE)}, warning = function (cnd) { attr(out, "rng_metadata") <- rng_metadata if (getOption("warn") >= 2 || getOption("warn") < 0) { attr(out, "arguments") <- Arguments return() } attr(out, "parallel_metadata") <- list(requested_backend = requested_backend, watcher$capture_plot_and_output() backend = backend, selection_reason = execution$reason, if (on_warning$capture) { requested_ncores = as.integer(ncores), workers = as.integer(workers), cnd <- sanitize_call(cnd) tasks = as.integer(N_trials)) watcher$push(cnd) if (nrow(failures) > 0L) { } warning(nrow(failures), " of ", N_trials, " simulated trials failed and were excluded. See `result$failures` ", if (on_warning$silence) { "for details.", call. = FALSE) invokeRestart("muffleWarning") } } return(out)}, error = function (cnd) })(cutpoints = c(26, 52), generation_cutpoints = 52, N_total = 1000, { lambda = c(0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6), lambda_time = c(4.33333333333333, watcher$capture_plot_and_output() 8.66666666666667, 13, 17.3333333333333, 21.6666666666667, cnd <- sanitize_call(cnd) 26), interim_look = c(400, 500, 600, 700, 800, 900), end_of_study = 69.3333333333333, watcher$push(cnd) prior_surv = c(1, 144.927536231884, 1, 144.927536231884, switch(on_error, continue = invokeRestart("eval_continue"), 1, 285.714285714286), block = 3, rand_ratio = c(control = 1, stop = invokeRestart("eval_stop"), error = NULL) treatment = 2), prop_loss = 0.1, alternative = "less", h0 = 0, }) Fn = c(0.01, 0.01, 0.01, 0.01, 0.01, 0.01), Sn = c(1, 0.95, 0.95, 0.95, 0.95, 0.95), prob_ha = 0.981, N_impute = 300, 28: mc_conf_level = 0.95, empty_interval = "prior", method = "logrank", eval(call) imputed_final = FALSE, hazard_treatment = c(0.005796, 0.00168 ), hazard_control = c(0.00828, 0.0024), N_trials = 20, ncores = 2, 29: seed = 3425430)eval(call) 23: 30: do.call(sim_trials, c(anthem_common, list(hazard_treatment = hazard_treatment_target_week, with_handlers({ hazard_control = hazard_control_week, N_trials = 20, ncores = 2, for (expr in tle$exprs) { seed = 3425430))) ev <- withVisible(eval(expr, envir)) watcher$capture_plot_and_output()24: watcher$print_value(ev$value, ev$visible, envir)eval(expr, envir) } TRUE25: }, handlers)eval(expr, envir) 31: 26: doWithOneRestart(return(expr), restart) withVisible(eval(expr, envir))32: withOneRestart(expr, restarts[[1L]])27: withCallingHandlers(code, error = function (e) 33: rlang::entrace(e), message = function (cnd) withRestartList(expr, restarts[-nr]){ watcher$capture_plot_and_output()34: if (on_message$capture) {doWithOneRestart(return(expr), restart) watcher$push(cnd) }35: if (on_message$silence) {withOneRestart(withRestartList(expr, restarts[-nr]), restarts[[nr]]) invokeRestart("muffleMessage") }36: }, warning = function (cnd) withRestartList(expr, restarts){ if (getOption("warn") >= 2 || getOption("warn") < 0) {37: withRestarts(with_handlers({ return() for (expr in tle$exprs) { } ev <- withVisible(eval(expr, envir)) watcher$capture_plot_and_output() watcher$capture_plot_and_output() watcher$print_value(ev$value, ev$visible, envir) if (on_warning$capture) { } cnd <- sanitize_call(cnd) TRUE watcher$push(cnd)}, handlers), eval_continue = function() TRUE, eval_stop = function() FALSE) } 38: if (on_warning$silence) {evaluate::evaluate(...) invokeRestart("muffleWarning") }39: evaluate(code, envir = env, new_device = FALSE, keep_warning = if (is.numeric(options$warning)) TRUE else options$warning, }, error = function (cnd) keep_message = if (is.numeric(options$message)) TRUE else options$message, { stop_on_error = if (is.numeric(options$error)) options$error else { watcher$capture_plot_and_output() if (options$error && options$include) cnd <- sanitize_call(cnd) 0L else 2L watcher$push(cnd) }, output_handler = knit_handlers(options$render, options)) switch(on_error, continue = invokeRestart("eval_continue"), stop = invokeRestart("eval_stop"), error = NULL)40: })in_dir(input_dir(), expr) 28: 41: eval(call)in_input_dir(evaluate(code, envir = env, new_device = FALSE, 29: keep_warning = if (is.numeric(options$warning)) TRUE else options$warning, eval(call) keep_message = if (is.numeric(options$message)) TRUE else options$message, stop_on_error = if (is.numeric(options$error)) options$error else {30: if (options$error && options$include) with_handlers({ 0L for (expr in tle$exprs) { else 2L ev <- withVisible(eval(expr, envir)) }, output_handler = knit_handlers(options$render, options))) watcher$capture_plot_and_output() watcher$print_value(ev$value, ev$visible, envir)42: }eng_r(options) TRUE }, handlers)43: block_exec(params)31: doWithOneRestart(return(expr), restart)44: call_block(x)32: withOneRestart(expr, restarts[[1L]])45: process_group(group)33: withRestartList(expr, restarts[-nr])46: withCallingHandlers(if (tangle) process_tangle(group) else process_group(group), 34: error = function(e) {doWithOneRestart(return(expr), restart) if (progress && is.function(pb$interrupt)) pb$interrupt()35: if (is_R_CMD_build() || is_R_CMD_check()) withOneRestart(withRestartList(expr, restarts[-nr]), restarts[[nr]]) error <<- format(e) })36: withRestartList(expr, restarts)47: with_options(withCallingHandlers(if (tangle) process_tangle(group) else process_group(group), error = function(e) { if (progress && is.function(pb$interrupt)) 37: pb$interrupt()withRestarts(with_handlers({ if (is_R_CMD_build() || is_R_CMD_check()) for (expr in tle$exprs) { error <<- format(e) ev <- withVisible(eval(expr, envir)) }), list(rlang_trace_top_env = knit_global())) watcher$capture_plot_and_output() watcher$print_value(ev$value, ev$visible, envir)48: }xfun:::handle_error(with_options(withCallingHandlers(if (tangle) process_tangle(group) else process_group(group), TRUE error = function(e) {}, handlers), eval_continue = function() TRUE, eval_stop = function() FALSE) if (progress && is.function(pb$interrupt)) pb$interrupt()38: if (is_R_CMD_build() || is_R_CMD_check()) evaluate::evaluate(...) error <<- format(e) }), list(rlang_trace_top_env = knit_global())), function(loc) {39: setwd(wd)evaluate(code, envir = env, new_device = FALSE, keep_warning = if (is.numeric(options$warning)) TRUE else options$warning, write_utf8(res, output %n% stdout()) keep_message = if (is.numeric(options$message)) TRUE else options$message, paste0("\nQuitting from ", loc, if (!is.null(error)) stop_on_error = if (is.numeric(options$error)) options$error else { paste0("\n", rule(), error, "\n", rule())) if (options$error && options$include) }, if (labels[i] != "") sprintf(" [%s]", labels[i]), get_loc) 0L else 2L }, output_handler = knit_handlers(options$render, options))49: process_file(text, output)40: in_dir(input_dir(), expr)50: knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)41: in_input_dir(evaluate(code, envir = env, new_device = FALSE, 51: rmarkdown::render(file, encoding = encoding, quiet = quiet, envir = globalenv(), keep_warning = if (is.numeric(options$warning)) TRUE else options$warning, output_dir = getwd(), ...) keep_message = if (is.numeric(options$message)) TRUE else options$message, stop_on_error = if (is.numeric(options$error)) options$error else {52: if (options$error && options$include) vweave_rmarkdown(...) 0L else 2L53: }, output_handler = knit_handlers(options$render, options)))engine$weave(file, quiet = quiet, encoding = enc) 42: 54: eng_r(options)doTryCatch(return(expr), name, parentenv, handler) 43: 55: block_exec(params)tryCatchOne(expr, names, parentenv, handlers[[1L]]) 44: 56: call_block(x)tryCatchList(expr, classes, parentenv, handlers) 45: 57: process_group(group)tryCatch({ engine$weave(file, quiet = quiet, encoding = enc)46: setwd(startdir)withCallingHandlers(if (tangle) process_tangle(group) else process_group(group), output <- find_vignette_product(name, by = "weave", engine = engine) error = function(e) { if (!have.makefile && vignette_is_tex(output)) { if (progress && is.function(pb$interrupt)) texi2pdf(file = output, clean = FALSE, quiet = quiet) pb$interrupt() output <- find_vignette_product(name, by = "texi2pdf", if (is_R_CMD_build() || is_R_CMD_check()) engine = engine) error <<- format(e) } })}, error = function(e) { OK <<- FALSE47: message(gettextf("Error: processing vignette '%s' failed with diagnostics:\n%s", with_options(withCallingHandlers(if (tangle) process_tangle(group) else process_group(group), file, conditionMessage(e))) error = function(e) {}) if (progress && is.function(pb$interrupt)) pb$interrupt()58: if (is_R_CMD_build() || is_R_CMD_check()) tools:::.buildOneVignette("anthem-hfref.Rmd", "/Volumes/Builds/packages/big-sur-arm64/results/4.5/goldilocks.Rcheck/vign_test/goldilocks", error <<- format(e) TRUE, TRUE, "anthem-hfref", "UTF-8", "/Volumes/Temp/tmp/RtmpZ7iG4P/filef0207a440203.rds") }), list(rlang_trace_top_env = knit_global())) An irrecoverable exception occurred. R is aborting now ... 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("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/RtmpZ7iG4P/filef0207a440203.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-11-03 14:47:57.891 R[63112:450345] XType: Using static font registry. --- finished re-building ‘calibrating-prob-ha.Rmd’ --- re-building ‘decision-traces.Rmd’ using rmarkdown 2026-11-03 14:47:59.726 R[63175:450566] 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-11-03 14:48:12.958 R[64111:452721] XType: Using static font registry. --- finished re-building ‘thermocool-af.Rmd’ --- re-building ‘two-arm.Rmd’ using rmarkdown 2026-11-03 14:48:14.831 R[64249:453131] 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