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