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


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

Traceback:
 1: regroup(attr(out, "groups"), environment())
 2: filter.tbl_df(., treatment == 1)
 3: filter(., treatment == 1)
 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) %>% mutate(Y_impute = ifelse(subject_impute_success &     subject_enrolled, rnorm(n(), mu_treatment, sd_treatment),     Y))
11: (function (mu_treatment, sd_treatment, mu_control = NULL, sd_control = NULL,     mu0_treatment = NULL, sd0_treatment = NULL, N0_treatment = NULL,     mu0_control = NULL, sd0_control = NULL, N0_control = NULL,     N_total, lambda = 0.3, lambda_time = NULL, interim_look = NULL,     EndofStudy, block = 2, rand_ratio = c(1, 1), discount_function = "identity",     alternative = "greater", prop_loss_to_followup = 0.15, h0 = 0,     futility_prob = 0.05, expected_success_prob = 0.9, prob_ha = 0.95,     N_impute = 10, number_mcmc = 10000, alpha_max = 1, fix_alpha = FALSE,     weibull_scale = 0.135, weibull_shape = 3, method = "fixed") {    stopifnot((mu_treatment > 0 & sd_treatment > 0), all(N_total >         interim_look), length(lambda) == (length(lambda_time) +         1), EndofStudy > 0, block%%sum(rand_ratio) == 0, (prop_loss_to_followup >=         0 & prop_loss_to_followup < 0.75), (futility_prob < 0.2 &         futility_prob >= 0), (expected_success_prob > 0.7 & expected_success_prob <=         1), (prob_ha > 0.7 & prob_ha < 1), N_impute > 0)    if (alternative != "two-sided" & alternative != "greater" &         alternative != "less") {        stop("The input for alternative is wrong!")    }    analysis_at_enrollnumber <- c(interim_look, N_total)    enrollment <- enrollment(param = lambda, N_total = N_total,         time = lambda_time)    if (!is.null(mu_control)) {        group <- randomization(N_total = N_total, block = block,             allocation = rand_ratio)    }    else {        group <- rep(1, N_total)    }    if (!is.null(mu_control)) {        sim <- rnorm(N_total, mean = group * mu_treatment + (1 -             group) * mu_control, sd = group * sd_treatment +             (1 - group) * sd_control)        control <- sim[group == 0]    }    else {        sim <- rnorm(N_total, mean = mu_treatment, sd = sd_treatment)    }    treatment <- sim[group == 1]    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(Y = sim, treatment = group, enrollment = enrollment,         id = 1:N_total, loss_to_fu = 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 = (enrollment[analysis_at_enrollnumber[i]] -                 enrollment <= EndofStudy & subject_enrolled) |                 (subject_enrolled & loss_to_fu))            data <- data_interim %>% filter(subject_enrolled,                 !subject_impute_success)            if (!is.null(mu_control)) {                mu_c <- mean(data$Y[data$treatment == 0])                sd_c <- sd(data$Y[data$treatment == 0])                N_c <- length(data$treatment == 0)            }            else {                mu_c <- NULL                sd_c <- NULL                N_c <- NULL            }            post <- bdpnormal(mu_t = mean(data$Y[data$treatment ==                 1]), sigma_t = sd(data$Y[data$treatment == 1]),                 N_t = length(data$treatment == 1), mu_c = mu_c,                 sigma_c = sd_c, N_c = N_c, mu0_t = mu0_treatment,                 sigma0_t = sd0_treatment, N0_t = N0_treatment,                 mu0_c = mu0_control, sigma0_c = sd0_control,                 N0_c = N0_control, number_mcmc = number_mcmc,                 discount_function = discount_function, alpha_max = alpha_max,                 fix_alpha = fix_alpha, weibull_scale = weibull_scale,                 weibull_shape = weibull_shape, method = method)            futility_test <- 0            expected_success_test <- 0            for (j in 1:N_impute) {                data_control_success_impute <- data_interim %>%                   filter(treatment == 0) %>% mutate(Y_impute = ifelse(subject_impute_success &                   subject_enrolled, rnorm(n(), mu_control, sd_control),                   Y))                data_treatment_success_impute <- data_interim %>%                   filter(treatment == 1) %>% mutate(Y_impute = ifelse(subject_impute_success &                   subject_enrolled, rnorm(n(), mu_treatment,                   sd_treatment), Y))                data_success_impute <- bind_rows(data_control_success_impute,                   data_treatment_success_impute) %>% mutate(Y = Y_impute) %>%                   select(-Y_impute)                data <- data_success_impute %>% filter(subject_enrolled)                if (!is.null(mu_control)) {                  mu_c <- mean(data$Y[data$treatment == 0])                  sd_c <- sd(data$Y[data$treatment == 0])                  N_c <- length(data$treatment == 0)                }                else {                  mu_c <- NULL                  sd_c <- NULL                  N_c <- NULL                }                post_imp <- bdpnormal(mu_t = mean(data$Y[data$treatment ==                   1]), sigma_t = sd(data$Y[data$treatment ==                   1]), N_t = length(data$treatment == 1), mu_c = mu_c,                   sigma_c = sd_c, N_c = N_c, mu0_t = mu0_treatment,                   sigma0_t = sd0_treatment, N0_t = N0_treatment,                   mu0_c = mu0_control, sigma0_c = sd0_control,                   N0_c = N0_control, number_mcmc = number_mcmc,                   discount_function = discount_function, alpha_max = alpha_max,                   fix_alpha = fix_alpha, weibull_scale = weibull_scale,                   weibull_shape = weibull_shape, method = method)                if (!is.null(mu_control)) {                  if (alternative == "two-sided") {                    effect_imp <- post_imp$posterior_treatment$posterior_mu -                       post_imp$posterior_control$posterior_mu                    success <- max(c(mean(effect_imp > h0), mean(-effect_imp >                       h0)))                  }                  else if (alternative == "greater") {                    effect_imp <- post_imp$posterior_treatment$posterior_mu -                       post_imp$posterior_control$posterior_mu                    success <- mean(effect_imp > h0)                  }                  else {                    effect_imp <- post_imp$posterior_treatment$posterior_mu -                       post_imp$posterior_control$posterior_mu                    success <- mean(-effect_imp > h0)                  }                }                else {                  effect_imp <- post_imp$posterior_treatment$posterior_mu                  if (alternative == "two-sided") {                    success <- max(c(mean(effect_imp - mu_treatment >                       h0), mean(mu_treatment - effect_imp > h0)))                  }                  else if (alternative == "greater") {                    success <- mean(effect_imp - mu_treatment >                       h0)                  }                  else {                    success <- mean(mu_treatment - effect_imp >                       h0)                  }                }                if (success > prob_ha) {                  expected_success_test <- expected_success_test +                     1                }                data_control_futility_impute <- data_success_impute %>%                   filter(treatment == 0) %>% mutate(Y_impute = ifelse(subject_impute_futility,                   rnorm(n(), mu_control, sd_control), Y))                data_treatment_futility_impute <- data_success_impute %>%                   filter(treatment == 1) %>% mutate(Y_impute = ifelse(subject_impute_futility,                   rnorm(n(), mu_treatment, sd_treatment), Y))                data_futility_impute <- bind_rows(data_control_futility_impute,                   data_treatment_futility_impute) %>% mutate(Y = Y_impute) %>%                   select(-Y_impute)                data <- data_futility_impute                if (!is.null(mu_control)) {                  mu_c <- mean(data$Y[data$treatment == 0])                  sd_c <- sd(data$Y[data$treatment == 0])                  N_c <- length(data$treatment == 0)                }                else {                  mu_c <- NULL                  sd_c <- NULL                  N_c <- NULL                }                post_imp <- bdpnormal(mu_t = mean(data$Y[data$treatment ==                   1]), sigma_t = sd(data$Y[data$treatment ==                   1]), N_t = length(data$treatment == 1), mu_c = mu_c,                   sigma_c = sd_c, N_c = N_c, mu0_t = mu0_treatment,                   sigma0_t = sd0_treatment, N0_t = N0_treatment,                   mu0_c = mu0_control, sigma0_c = sd0_control,                   N0_c = N0_control, number_mcmc = number_mcmc,                   discount_function = discount_function, alpha_max = alpha_max,                   fix_alpha = fix_alpha, weibull_scale = weibull_scale,                   weibull_shape = weibull_shape, method = method)                if (!is.null(mu_control)) {                  if (alternative == "two-sided") {                    effect_imp <- post_imp$posterior_treatment$posterior_mu -                       post_imp$posterior_control$posterior_mu                    success <- max(c(mean(effect_imp > h0), mean(-effect_imp >                       h0)))                  }                  else if (alternative == "greater") {                    effect_imp <- post_imp$posterior_treatment$posterior_mu -                       post_imp$posterior_control$posterior_mu                    success <- mean(effect_imp > h0)                  }                  else {                    effect_imp <- post_imp$posterior_treatment$posterior_mu -                       post_imp$posterior_control$posterior_mu                    success <- mean(-effect_imp > h0)                  }                }                else {                  effect_imp <- post_imp$posterior_treatment$posterior_mu                  if (alternative == "two-sided") {                    success <- max(c(mean(effect_imp - mu_treatment >                       h0), mean(mu_treatment - effect_imp > h0)))                  }                  else if (alternative == "greater") {                    success <- mean(effect_imp - mu_treatment >                       h0)                  }                  else {                    success <- mean(mu_treatment - 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 (!is.null(mu_control)) {            if (alternative == "two-sided") {                effect_int <- post$posterior_treatment$posterior_mu -                   post$posterior_control$posterior_mu            }            else if (alternative == "greater") {                effect_int <- post$posterior_treatment$posterior_mu -                   post$posterior_control$posterior_mu            }            else {                effect_int <- post$posterior_treatment$posterior_mu -                   post$posterior_control$posterior_mu            }        }        else {            effect_int <- post$posterior_treatment$posterior_mu        }        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,         !loss_to_fu)    if (!is.null(mu_control)) {        mu_c <- mean(data_final$Y[data_final$treatment == 0])        sd_c <- sd(data_final$Y[data_final$treatment == 0])        N_c <- length(data_final$treatment == 0)    }    else {        mu_c <- NULL        sd_c <- NULL        N_c <- NULL    }    post_final <- bdpnormal(mu_t = mean(data_final$Y[data_final$treatment ==         1]), sigma_t = sd(data_final$Y[data_final$treatment ==         1]), N_t = length(data_final$treatment == 1), mu_c = mu_c,         sigma_c = sd_c, N_c = N_c, mu0_t = mu0_treatment, sigma0_t = sd0_treatment,         N0_t = N0_treatment, mu0_c = mu0_control, sigma0_c = sd0_control,         N0_c = N0_control, discount_function = discount_function,         number_mcmc = number_mcmc, alpha_max = alpha_max, fix_alpha = fix_alpha,         weibull_scale = weibull_scale, weibull_shape = weibull_shape,         method = method)    if (!is.null(mu_control)) {        if (alternative == "two-sided") {            effect <- post_final$posterior_treatment$posterior_mu -                 post_final$posterior_control$posterior_mu            post_paa <- max(c(mean(effect > h0), mean(-effect >                 h0)))        }        else if (alternative == "greater") {            effect <- post_final$posterior_treatment$posterior_mu -                 post_final$posterior_control$posterior_mu            post_paa <- mean(effect > h0)        }        else {            effect <- post_final$posterior_treatment$posterior_mu -                 post_final$posterior_control$posterior_mu            post_paa <- mean(-effect > h0)        }    }    else {        effect <- post_final$posterior_treatment$posterior_mu        if (alternative == "two-sided") {            post_paa <- max(c(mean(effect - mu_treatment > h0),                 mean(mu_treatment - effect > h0)))        }        else if (alternative == "greater") {            post_paa <- mean(effect - mu_treatment > h0)        }        else {            post_paa <- mean(mu_treatment - effect > h0)        }    }    N_treatment <- sum(data_final$treatment)    N_control <- sum(!data_final$treatment)    results_list <- list(mu_treatment = mu_treatment, mu_control = mu_control,         sd_treatment = sd_treatment, sd_control = sd_control,         prob_of_accepting_alternative = prob_ha, margin = h0,         alternative = alternative, interim_look = interim_look,         N_treatment = N_treatment, N_control = N_control, N_complete = N_treatment +             N_control, N_enrolled = N_enrolled, 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})(mu_treatment = 120, sd_treatment = 5.5, N_total = 400, EndofStudy = 60,     prop_loss_to_followup = 0.1, interim_look = c(350, 380),     lambda = c(0.4, 0.7), lambda_time = 40, h0 = -10, futility_prob = 0.1,     prob_ha = 0.95, expected_success_prob = 0.85, alternative = "less",     N_impute = 20, number_mcmc = 2000)
12: do.call(normalBACT, input)
13: simulate(., no_of_sim = 10)
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 = 10)
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("normal.Rmd", "/home/hornik/tmp/R.check/r-devel-gcc/Work/PKGS/bayesCT.Rcheck/vign_test/bayesCT",     TRUE, FALSE, "normal", "UTF-8", "/home/hornik/tmp/scratch/RtmpMeW77x/file2e9085f919.rds")
An irrecoverable exception occurred. R is aborting now ...
Segmentation fault
--- re-building ‘time-to-event.Rmd’ using rmarkdown

Attaching package: 'bayesCT'

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

    simulate

--- finished re-building ‘time-to-event.Rmd’

SUMMARY: processing the following file failed:
  ‘normal.Rmd’

Error: Vignette re-building failed.
Execution halted