CRAN Package Check Results for Package goldilocks

Last updated on 2026-11-13 02:59:30 CET.

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