Error(s) in re-building vignettes:
  ...
--- re-building ‘bayesCT.Rmd’ using rmarkdown
--- finished re-building ‘bayesCT.Rmd’

--- re-building ‘binomial.Rmd’ using rmarkdown

Attaching package: 'bayesCT'

The following object is masked from 'package:stats':

    simulate

--- finished re-building ‘binomial.Rmd’

--- re-building ‘normal.Rmd’ using rmarkdown

Attaching package: 'bayesCT'

The following object is masked from 'package:stats':

    simulate

--- finished re-building ‘normal.Rmd’

--- re-building ‘time-to-event.Rmd’ using rmarkdown

Attaching package: 'bayesCT'

The following object is masked from 'package:stats':

    simulate


 *** caught segfault ***
address 0x200000069, cause 'memory not mapped'

Traceback:
 1: regroup(attr(out, "groups"), environment())
 2: filter.tbl_df(., treatment == 1 & subject_impute_success)
 3: filter(., treatment == 1 & subject_impute_success)
 4: function_list[[i]](value)
 5: freduce(value, `_function_list`)
 6: `_fseq`(`_lhs`)
 7: eval(quote(`_fseq`(`_lhs`)), env, env)
 8: eval(quote(`_fseq`(`_lhs`)), env, env)
 9: withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
10: data_interim %>% filter(treatment == 1 & subject_impute_success) %>%     bind_cols(time_impute = impute_treatment$time, event_impute = impute_treatment$event)
11: (function (hazard_treatment, cutpoint = NULL, hazard_control = NULL,     N_total, breaks = NULL, time0 = NULL, treatment0 = NULL,     event0 = NULL, lambda = 0.3, lambda_time = NULL, interim_look = NULL,     EndofStudy, prior = c(0.1, 0.1), block = 2, rand_ratio = c(1,         1), prop_loss_to_followup = 0.1, alternative = "greater",     h0 = 0, futility_prob = 0.05, expected_success_prob = 0.9,     prob_ha = 0.95, N_impute = 10, number_mcmc = 10000, discount_function = "identity",     alpha_max = 1, fix_alpha = FALSE, weibull_scale = 0.135,     weibull_shape = 3, method = "fixed") {    if (!is.null(interim_look)) {        stopifnot(all(N_total > interim_look))    }    if (!is.null(time0)) {        data0 <- data.frame(cbind(time = time0, event = event0,             treatment = treatment0))    }    else {        data0 <- NULL    }    if (alternative != "two-sided" & alternative != "greater" &         alternative != "less") {        stop("The input for alternative is wrong!")    }    if (!is.null(cutpoint)) {        breaks <- cutpoint    }    if (!is.null(breaks)) {        stopifnot(any(breaks < EndofStudy))    }    if (is.null(hazard_control) & h0 == 0) {        h0 <- 0.5    }    analysis_at_enrollnumber <- c(interim_look, N_total)    enrollment <- enrollment(param = lambda, N_total = N_total,         time = lambda_time)    if (!is.null(hazard_control)) {        group <- randomization(N_total = N_total, block = block,             allocation = rand_ratio)    }    else {        group <- rep(1, N_total)    }    time <- rep(NA, length = N_total)    event <- rep(NA, length = N_total)    if (!is.null(hazard_control)) {        sim_control <- pw_exp_sim(hazard = hazard_control, n = sum(!group),             maxtime = EndofStudy, cutpoint = cutpoint)        time[which(!group)] <- sim_control$time        event[which(!group)] <- sim_control$event    }    sim_treatment <- pw_exp_sim(hazard = hazard_treatment, n = sum(group),         maxtime = EndofStudy, cutpoint = cutpoint)    time[which(!!group)] <- sim_treatment$time    event[which(!!group)] <- sim_treatment$event    if (is.null(breaks)) {        breaks <- mean(time)    }    n_loss_to_fu <- ceiling(prop_loss_to_followup * N_total)    loss_to_fu <- rep(FALSE, N_total)    loss_to_fu[sample(1:N_total, n_loss_to_fu)] <- TRUE    data_total <- data.frame(time = time, treatment = group,         event = event, enrollment = enrollment, id = 1:N_total,         loss_to_fu = loss_to_fu)    data_total$time[data_total$loss_to_fu] <- runif(n_loss_to_fu,         0, data_total$time[data_total$loss_to_fu])    data_total$event[data_total$loss_to_fu] <- rep(0, n_loss_to_fu)    stop_futility <- 0    stop_expected_success <- 0    if (length(analysis_at_enrollnumber) > 1) {        for (i in 1:(length(analysis_at_enrollnumber) - 1)) {            data_interim <- data_total %>% mutate(subject_enrolled = id <=                 analysis_at_enrollnumber[i], subject_impute_futility = !subject_enrolled) %>%                 group_by(subject_enrolled) %>% mutate(subject_impute_success = event *                 (enrollment[analysis_at_enrollnumber[i]] - enrollment <=                   EndofStudy & subject_enrolled) | (1 - event) *                 (enrollment[analysis_at_enrollnumber[i]] - enrollment <=                   time & subject_enrolled) | (subject_enrolled &                 loss_to_fu)) %>% mutate(real_time = ifelse(event *                 (enrollment[analysis_at_enrollnumber[i]] - enrollment <=                   EndofStudy & subject_enrolled) | (1 - event) *                 (enrollment[analysis_at_enrollnumber[i]] - enrollment <=                   time & subject_enrolled), enrollment[analysis_at_enrollnumber[i]] -                 enrollment + sd(time)/10000, time)) %>% mutate(real_event = ifelse(event *                 (enrollment[analysis_at_enrollnumber[i]] - enrollment <=                   EndofStudy & subject_enrolled) | (1 - event) *                 (enrollment[analysis_at_enrollnumber[i]] - enrollment <=                   time & subject_enrolled), 0, event))            data_interim <- data_interim %>% mutate(time = real_time,                 event = real_event) %>% select(-c(real_time,                 real_event))            data <- data_interim %>% filter(subject_enrolled) %>%                 ungroup() %>% select(time, event, treatment)            post <- suppressWarnings(bdpsurvival(formula = Surv(time,                 event) ~ treatment, data = data, data0 = data0,                 breaks = breaks, a0 = prior[1], b0 = prior[2],                 surv_time = EndofStudy, discount_function = discount_function,                 alpha_max = alpha_max, fix_alpha = fix_alpha,                 number_mcmc = number_mcmc, weibull_scale = weibull_scale,                 weibull_shape = weibull_shape, method = method))            futility_test <- 0            expected_success_test <- 0            for (j in 1:N_impute) {                if (!is.null(hazard_control)) {                  control_impute <- data_interim %>% filter(treatment ==                     0 & subject_impute_success)                  impute_control <- pw_exp_impute(time = control_impute$time,                     hazard = post$posterior_control$posterior_flat_hazard[i,                       ], maxtime = EndofStudy, cutpoint = post$args1$breaks)                  data_control_success_impute <- data_interim %>%                     filter(treatment == 0 & subject_impute_success) %>%                     bind_cols(time_impute = impute_control$time,                       event_impute = impute_control$event)                }                else {                  data_control_success_impute <- NULL                }                treatment_impute <- data_interim %>% filter(treatment ==                   1 & subject_impute_success)                impute_treatment <- pw_exp_impute(time = treatment_impute$time,                   hazard = post$posterior_treatment$posterior_flat_hazard[i,                     ], maxtime = EndofStudy, cutpoint = post$args1$breaks)                data_treatment_success_impute <- data_interim %>%                   filter(treatment == 1 & subject_impute_success) %>%                   bind_cols(time_impute = impute_treatment$time,                     event_impute = impute_treatment$event)                data_noimpute <- data_interim %>% filter(!subject_impute_success) %>%                   mutate(time_impute = time, event_impute = event)                data_success_impute <- bind_rows(data_control_success_impute,                   data_treatment_success_impute, data_noimpute) %>%                   mutate(time = time_impute, event = event_impute) %>%                   select(-c(time_impute, event_impute))                data <- data_success_impute %>% filter(subject_enrolled) %>%                   ungroup() %>% select(time, event, treatment)                post_imp <- suppressWarnings(bdpsurvival(formula = Surv(time,                   event) ~ treatment, data = data, data0 = data0,                   breaks = breaks, a0 = prior[1], b0 = prior[2],                   surv_time = EndofStudy, discount_function = discount_function,                   alpha_max = alpha_max, fix_alpha = fix_alpha,                   number_mcmc = number_mcmc, weibull_scale = weibull_scale,                   weibull_shape = weibull_shape, method = method))                if (sum(data$treatment == 0) != 0) {                  effect_imp <- post_imp$final$posterior_loghazard                  if (alternative == "two-sided") {                    success <- max(c(mean(effect_imp > h0), mean(-effect_imp >                       h0)))                  }                  else if (alternative == "greater") {                    success <- mean(effect_imp > h0)                  }                  else {                    success <- mean(-effect_imp > h0)                  }                }                else {                  effect_imp <- post_imp$final$posterior_survival                  if (alternative == "two-sided") {                    success <- max(c(mean(effect_imp > h0), mean(effect_imp <                       h0)))                  }                  else if (alternative == "greater") {                    success <- mean(effect_imp > h0)                  }                  else {                    success <- mean(effect_imp < h0)                  }                }                if (success > prob_ha) {                  expected_success_test <- expected_success_test +                     1                }                if (!is.null(hazard_control)) {                  control_impute <- data_success_impute %>% filter(treatment ==                     0 & subject_impute_futility)                  impute_control <- pw_exp_sim(hazard = post$posterior_control$posterior_flat_hazard[i,                     ], n = nrow(control_impute), maxtime = EndofStudy,                     cutpoint = post$args1$breaks)                  data_control_futility_impute <- data_success_impute %>%                     filter(treatment == 0 & subject_impute_futility) %>%                     bind_cols(time_impute = impute_control$time,                       event_impute = impute_control$event)                }                else {                  data_control_futility_impute <- NULL                }                treatment_impute <- data_success_impute %>% filter(treatment ==                   1 & subject_impute_futility)                impute_treatment <- pw_exp_sim(hazard = post$posterior_treatment$posterior_flat_hazard[i,                   ], n = nrow(treatment_impute), maxtime = EndofStudy,                   cutpoint = post$args1$breaks)                data_treatment_futility_impute <- data_success_impute %>%                   filter(treatment == 1 & subject_impute_futility) %>%                   bind_cols(time_impute = impute_treatment$time,                     event_impute = impute_treatment$event)                data_noimpute_futility <- data_success_impute %>%                   filter(!subject_impute_futility) %>% mutate(time_impute = time,                   event_impute = event)                data_futility_impute <- bind_rows(data_control_futility_impute,                   data_treatment_futility_impute, data_noimpute_futility) %>%                   mutate(time = time_impute, event = event_impute) %>%                   select(-c(time_impute, event_impute))                data <- data_futility_impute %>% ungroup() %>%                   select(time, event, treatment)                post_imp <- suppressWarnings(bdpsurvival(formula = Surv(time,                   event) ~ treatment, data = data, data0 = data0,                   breaks = breaks, a0 = prior[1], b0 = prior[2],                   surv_time = EndofStudy, discount_function = discount_function,                   alpha_max = alpha_max, fix_alpha = fix_alpha,                   number_mcmc = number_mcmc, weibull_scale = weibull_scale,                   weibull_shape = weibull_shape, method = method))                if (sum(data$treatment == 0) != 0) {                  effect_imp <- post_imp$final$posterior_loghazard                  if (alternative == "two-sided") {                    success <- max(c(mean(effect_imp > h0), mean(-effect_imp >                       h0)))                  }                  else if (alternative == "greater") {                    success <- mean(effect_imp > h0)                  }                  else {                    success <- mean(-effect_imp > h0)                  }                }                else {                  effect_imp <- post_imp$final$posterior_survival                  if (alternative == "two-sided") {                    success <- max(c(mean(effect_imp > h0), mean(effect_imp <                       h0)))                  }                  else if (alternative == "greater") {                    success <- mean(effect_imp > h0)                  }                  else {                    success <- mean(effect_imp < h0)                  }                }                if (success > prob_ha) {                  futility_test <- futility_test + 1                }            }            if (expected_success_test/N_impute > expected_success_prob) {                stop_expected_success <- 1                stage_trial_stopped <- analysis_at_enrollnumber[i]                break            }            if (futility_test/N_impute < futility_prob) {                stop_futility <- 1                stage_trial_stopped <- analysis_at_enrollnumber[i]                break            }            if (analysis_at_enrollnumber[i + 1] == N_total) {                stage_trial_stopped <- analysis_at_enrollnumber[i +                   1]                break            }        }        if (sum(data$treatment == 0) != 0) {            if (alternative == "two-sided") {                effect_int <- post$final$posterior_loghazard            }            else if (alternative == "greater") {                effect_int <- post$final$posterior_loghazard            }            else {                effect_int <- post$final$posterior_loghazard            }        }        else {            effect_int <- post_imp$posterior_treatment$posterior_survival        }        N_enrolled <- nrow(data_interim[data_interim$id <= stage_trial_stopped,             ])    }    else {        N_enrolled <- N_total        stage_trial_stopped <- N_total        stop_futility <- 0        stop_expected_success <- 0    }    data_final <- data_total %>% filter(id <= stage_trial_stopped) %>%         ungroup() %>% select(time, event, treatment)    post_final <- suppressWarnings(bdpsurvival(formula = Surv(time,         event) ~ treatment, data = data_final, data0 = data0,         breaks = breaks, a0 = prior[1], b0 = prior[2], surv_time = EndofStudy,         discount_function = discount_function, alpha_max = alpha_max,         fix_alpha = fix_alpha, number_mcmc = number_mcmc, weibull_scale = weibull_scale,         weibull_shape = weibull_shape, method = method))    data_final <- data_total %>% filter(id <= stage_trial_stopped)    if (sum(data_final$treatment == 0) != 0) {        effect <- post_final$final$posterior_loghazard        if (alternative == "two-sided") {            post_paa <- max(c(mean(effect > h0), mean(-effect >                 h0)))        }        else if (alternative == "greater") {            post_paa <- mean(effect > h0)        }        else {            post_paa <- mean(-effect > h0)        }    }    else {        effect <- post_final$final$posterior_survival        if (alternative == "two-sided") {            post_paa <- max(c(mean(effect > h0), mean(effect >                 h0)))        }        else if (alternative == "greater") {            post_paa <- mean(effect > h0)        }        else {            post_paa <- mean(effect < h0)        }    }    N_treatment <- sum(!!data_final$treatment)    N_control <- sum(!data_final$treatment)    results_list <- list(hazard_treatment = hazard_treatment,         hazard_control = hazard_control, cutpoint = cutpoint,         prob_of_accepting_alternative = prob_ha, margin = h0,         alternative = alternative, interim_look = interim_look,         N_treatment = N_treatment, N_control = N_control, N_enrolled = N_treatment +             N_control, N_max = N_total, post_prob_accept_alternative = post_paa,         est_final = mean(effect), stop_futility = stop_futility,         stop_expected_success = stop_expected_success)    if (length(analysis_at_enrollnumber) > 1) {        results_list <- c(results_list, est_interim = mean(effect_int))    }    results_list})(hazard_treatment = c(0.012, 0.008), cutpoint = 30, N_total = 200,     EndofStudy = 70, prop_loss_to_followup = 0.1, interim_look = 180,     lambda = c(0.25, 0.8), lambda_time = 40, h0 = 0.6, futility_prob = 0.05,     prob_ha = 0.95, expected_success_prob = 0.9, alternative = "less",     N_impute = 10, number_mcmc = 2000, prior = c(0.2, 0.2))
12: do.call(survivalBACT, input_t1)
13: simulate(., no_of_sim = 5)
14: function_list[[k]](value)
15: withVisible(function_list[[k]](value))
16: freduce(value, `_function_list`)
17: `_fseq`(`_lhs`)
18: eval(quote(`_fseq`(`_lhs`)), env, env)
19: eval(quote(`_fseq`(`_lhs`)), env, env)
20: withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
21: value %>% simulate(no_of_sim = 5)
22: eval(expr, envir, enclos)
23: eval(expr, envir, enclos)
24: withVisible(eval(expr, envir, enclos))
25: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler,     error = eHandler, message = mHandler)
26: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir,     enclos)), warning = wHandler, error = eHandler, message = mHandler))
27: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr,     envir, enclos)), warning = wHandler, error = eHandler, message = mHandler)))
28: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos,     debug = debug, last = i == length(out), use_try = stop_on_error !=         2L, keep_warning = keep_warning, keep_message = keep_message,     output_handler = output_handler, include_timing = include_timing)
29: evaluate::evaluate(...)
30: evaluate(code, envir = env, new_device = FALSE, keep_warning = !isFALSE(options$warning),     keep_message = !isFALSE(options$message), stop_on_error = if (options$error &&         options$include) 0L else 2L, output_handler = knit_handlers(options$render,         options))
31: in_dir(input_dir(), evaluate(code, envir = env, new_device = FALSE,     keep_warning = !isFALSE(options$warning), keep_message = !isFALSE(options$message),     stop_on_error = if (options$error && options$include) 0L else 2L,     output_handler = knit_handlers(options$render, options)))
32: block_exec(params)
33: call_block(x)
34: process_group.block(group)
35: process_group(group)
36: withCallingHandlers(if (tangle) process_tangle(group) else process_group(group),     error = function(e) {        setwd(wd)        cat(res, sep = "\n", file = output %n% "")        message("Quitting from lines ", paste(current_lines(i),             collapse = "-"), " (", knit_concord$get("infile"),             ") ")    })
37: process_file(text, output)
38: knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)
39: rmarkdown::render(file, encoding = encoding, quiet = quiet, envir = globalenv(),     output_dir = getwd(), ...)
40: vweave_rmarkdown(...)
41: engine$weave(file, quiet = quiet, encoding = enc)
42: doTryCatch(return(expr), name, parentenv, handler)
43: tryCatchOne(expr, names, parentenv, handlers[[1L]])
44: tryCatchList(expr, classes, parentenv, handlers)
45: 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)))})
46: tools:::.buildOneVignette("time-to-event.Rmd", "/home/hornik/tmp/R.check/r-release-gcc/Work/PKGS/bayesCT.Rcheck/vign_test/bayesCT",     TRUE, FALSE, "time-to-event", "UTF-8", "/tmp/RtmpA3E1Yq/file34469104ba9.rds")
An irrecoverable exception occurred. R is aborting now ...
Segmentation fault
SUMMARY: processing the following file failed:
  ‘time-to-event.Rmd’

Error: Vignette re-building failed.
Execution halted