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