CRAN Package Check Results for Maintainer ‘Graeme L. Hickey <graemeleehickey at gmail.com>’

Last updated on 2026-11-14 17:50:42 CET.

Package OK ERROR
adaptDiag 13
bayesDP 13
goldilocks 12 1
joineR 13
joineRML 13

Package adaptDiag

Current CRAN status: OK: 13

Package bayesDP

Current CRAN status: OK: 13

Package goldilocks

Current CRAN status: OK: 12, ERROR: 1

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

Package joineR

Current CRAN status: OK: 13

Package joineRML

Current CRAN status: OK: 13