CRAN Package Check Results for Package goldilocks

Last updated on 2026-11-30 11:52:24 CET.

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