Error(s) in re-building vignettes:
  ...
--- re-building ‘revdbayes-a-vignette.Rmd’ using rmarkdown
Warning in engine$weave(file, quiet = quiet, encoding = enc) :
  Pandoc (>= 1.12.3) not available. Falling back to R Markdown v1.
--- finished re-building ‘revdbayes-a-vignette.Rmd’

Segmentation Fault - core dumped
--- re-building ‘revdbayes-b-using-rcpp-vignette.Rmd’ using rmarkdown
Warning in engine$weave(file, quiet = quiet, encoding = enc) :
  Pandoc (>= 1.12.3) not available. Falling back to R Markdown v1.

 *** caught segfault ***
address 4000000e, cause 'memory not mapped'

Traceback:
 1: (function (rho, psi_mode, rot_mat, hscale, logf, pars) {    .Call(`_rust_cpp_logf_rho`, rho, psi_mode, rot_mat, hscale,         logf, pars)})(rho = c(1.75108600751281, 0.101175043810632), psi_mode = c(0, 0), rot_mat = c(1, 0, 0, 1), hscale = 0, logf = <pointer: 9595970>,     pars = list(data = c(2.6115, 1.1285, 5.5985, 0.0745000000000005,     2.8115, 1.2045, 2.1265, 0.503500000000001, 1.0695, 1.8315,     0.00450000000000017, 4.0975, 1.5655, 0.2115, 2.4095, 0.7045,     10.6805, 2.9135, 1.1075, 0.7385, 0.641500000000001, 6.4205,     1.1215, 3.3755, 3.0515, 1.0125, 0.8895, 0.575500000000001,     0.6135, 2.8415, 1.6465, 2.0955, 0.1935, 0.2305, 0.5345, 1.1715,     1.3475, 1.3475, 0.1175, 3.0385, 0.931500000000001, 0.676500000000001,     0.5185, 2.9095, 0.0705000000000005, 0.6795, 0.362500000000001,     0.194500000000001, 2.3705, 0.487500000000001, 0.8475, 1.8715,     1.7815, 3.6445, 0.875500000000001, 1.4415, 0.9375, 0.1695,     0.4175, 0.2135, 0.7845, 1.4175, 0.8455, 0.1235, 1.9925, 0.5155,     0.343500000000001, 1.2965, 3.0715, 0.7895, 0.1475, 0.726500000000001,     1.3525, 2.9375, 3.2575, 1.8225, 0.814500000000001, 8.9805,     5.5295, 0.6755, 1.3745, 0.439500000000001, 0.4385, 0.697500000000001,     3.6445, 1.4795, 2.1765, 1.7185, 2.1605, 1.3915, 1.6725, 0.681500000000001,     3.6735, 0.214500000000001, 3.5415, 2.0035, 6.7115, 5.1605,     1.6605, 2.2885, 0.4815, 1.6245, 3.2365, 4.1935, 0.5735, 0.1445,     8.5515, 0.0225000000000004, 12.2225, 5.6065), m = 110L, xm = 12.2225,         sum_gp = 214.27, prior = "gp_flat", min_xi = -1, max_xi = Inf,         trendsd = 0))
 2: do.call(logf_fun, c(list(rho = init_psi), logf_args))
 3: (function (logf, ..., n = 1, d = 1, init = NULL, trans = c("none",     "BC", "user"), phi_to_theta = NULL, log_j = NULL, user_args = list(),     lambda = rep(1L, d), lambda_tol = 1e-06, gm = NULL, rotate = ifelse(d ==         1, FALSE, TRUE), lower = rep(-Inf, d), upper = rep(Inf,         d), r = 1/2, ep = 0L, a_algor = if (d == 1) "nlminb" else "optim",     b_algor = c("nlminb", "optim"), a_method = c("Nelder-Mead",         "BFGS", "CG", "L-BFGS-B", "SANN", "Brent"), b_method = c("Nelder-Mead",         "BFGS", "CG", "L-BFGS-B", "SANN", "Brent"), a_control = list(),     b_control = list(), var_names = NULL, shoof = 0.2) {    Call <- match.call(expand.dots = TRUE)    if (shoof < 0 || shoof > 1) {        stop("''shoof'' must be in [0, 1]")    }    is_pointer <- (class(logf) == "externalptr")    if (!is_pointer) {        stop("logf must be an external pointer to a function")    }    pars <- list(...)    list_depth <- function(x) {        ifelse(is.list(x), 1L + max(sapply(x, list_depth)), 0L)    }    if (length(pars) > 0) {        pars_depth <- list_depth(pars)    }    else {        pars_depth <- 0    }    if (pars_depth > 1) {        par_names <- names(pars)        pars <- unlist(pars, recursive = FALSE)        if (!is.null(par_names)) {            keep_name <- nchar(par_names) + 2            names(pars) <- substring(names(pars), keep_name)        }    }    if (r < 0) {        stop("r must be non-negative")    }    a_algor <- match.arg(a_algor, c("optim", "nlminb"))    a_method <- match.arg(a_method)    b_algor <- match.arg(b_algor)    b_method <- match.arg(b_method)    if (any(upper <= lower)) {        stop("upper must be greater than lower, componentwise.")    }    trans <- match.arg(trans)    if (is.null(gm)) {        gm <- rep(1, d)    }    if (trans == "BC") {        lambda_type <- "numeric"        if (is.list(lambda)) {            lambda_type <- "list"            if (is.null(lambda$lambda)) {                stop("The list lambda must contain the object lambda$lambda")            }            if (!is.null(lambda$gm)) {                gm <- lambda$gm            }            if (!is.null(lambda$init_psi)) {                init <- lambda$init_psi            }            if (a_algor == "optim" & is.null(a_control$parscale)) {                a_control <- c(a_control, list(parscale = lambda$sd_psi))            }            if (!is.null(lambda$phi_to_theta)) {                phi_to_theta <- lambda$phi_to_theta            }            if (!is.null(lambda$log_j)) {                log_j <- lambda$log_j            }            if (!is.null(lambda$user_args)) {                user_args <- lambda$user_args            }            lambda <- lambda$lambda        }        lambda <- ifelse(abs(lambda) < lambda_tol, 0L, lambda)        if (!is.vector(lambda)) {            stop("lambda must be a numeric vector")        }        if (!(length(lambda) %in% c(1, d))) {            if (lambda_type == "numeric") {                stop("lambda must be a numeric vector of length d")            }            if (lambda_type == "list") {                stop("lambda$lambda must be a numeric vector of length d")            }        }        if (length(lambda) == 1) {            lambda <- rep(lambda, d)        }        if (any(upper <= 0)) {            stop("when trans = ``BC'' all elements of upper must be positive")        }        lower <- pmax(0, lower)        lower <- ifelse(lambda == 0, gm * log(lower), (lower^lambda -             1)/(lambda * gm^(lambda - 1)))        upper <- ifelse(lambda == 0, gm * log(upper), (upper^lambda -             1)/(lambda * gm^(lambda - 1)))    }    if (d == 1 & a_algor == "optim" & any(is.infinite(c(lower,         upper)))) {        a_algor = "nlminb"        warning("For d = 1 finite lower and upper bounds must be supplied when\n            using a_algor = `optim'.  a_algor has been changed to `nlminb'")    }    if (d == 1 & b_algor == "optim" & any(is.infinite(c(lower,         upper)))) {        b_algor = "nlminb"        warning("For d = 1 finite lower and upper bounds must be supplied when\n            using b_algor = `optim'.  b_algor has been changed to `nlminb'")    }    if (b_algor == "optim") {        if (b_method == "BFGS" | b_method == "CG") {            warning("Using optim with b_method==`BFGS' or `CG' can produce the error\n              message `non-finite finite-difference value'.  If you really want\n              to use BFGS or CG try setting ep to be positive but small, e.g.\n              ep=0.001.",                 immediate. = TRUE, noBreaks. = TRUE)        }    }    if (d == 1) {        a_method <- "Brent"        b_method <- "Brent"    }    if (d == 1) {        which_lam <- 1L    }    else {        which_lam <- which(lambda != 1L)    }    if (is.null(init)) {        init <- rep(1, d)        warning("No initial estimate of the mode given: a vector of ones has\n            been used",             noBreaks. = TRUE)    }    len_init <- length(init)    if (len_init == 1 & d > 1) {        init <- rep(init, length.out = d)        warning("d > 1 but init has length 1: a d-vector of inits has been used")    }    if (len_init != d & len_init != 1) {        stop("the length of init is incompatible with d")    }    if (d == 1 & rotate) {        rotate <- FALSE        warning("rotation is not relevant when d=1: no rotation is used")    }    ep <- abs(ep)    vals <- matrix(NA, ncol = d, nrow = 2 * d + 1)    colnames(vals) <- paste("vals", 1:d, sep = "")    conv <- rep(NA, 2 * d + 1)    big_val <- Inf    hscale <- 0    psi_mode <- rep(0, d)    is_pointer <- (class(phi_to_theta) == "externalptr")    if (trans == "none" & is_pointer) {        warning("phi_to_theta() not used when trans = ``none'': identity fn used")    }    if (!is_pointer & !is.null(phi_to_theta)) {        stop("phi_to_theta must be an external pointer to a function or NULL")    }    if (trans == "user" & is.null(phi_to_theta)) {        stop("When trans = ``user'' phi_to_theta must be supplied")    }    is_pointer <- (class(log_j) == "externalptr")    if (!is_pointer & !is.null(log_j)) {        stop("log_j must be an external pointer to a function or NULL")    }    rot_mat <- diag(d)    init_psi <- init    if (trans == "none") {        logf_fun <- cpp_logf_rho        a_obj_fun <- cpp_a_obj        lower_box_fun <- cpp_lower_box        upper_box_fun <- cpp_upper_box        ru_fun <- ru_cpp        logf_args <- list(psi_mode = rep(0, d), rot_mat = diag(d),             hscale = 0, logf = logf, pars = pars)        ru_args <- list(d = d, r = r)    }    else if (trans == "BC" & is.null(phi_to_theta)) {        logf_fun <- cpp_logf_rho_2        a_obj_fun <- cpp_a_obj_2        lower_box_fun <- cpp_lower_box_2        upper_box_fun <- cpp_upper_box_2        ru_fun <- ru_cpp_2        con <- lambda * gm^(lambda - 1)        tpars <- list(which_lam = which_lam - 1, lambda = lambda,             gm = gm, con = con)        tfun <- create_trans_xptr("case_2")        if (all(lambda != 0)) {            ptpfun <- create_psi_to_phi_xptr("no_zero")        }        else {            ptpfun <- create_psi_to_phi_xptr("has_zero")        }        phi_to_theta <- null_phi_to_theta_xptr("no_trans")        log_j <- create_log_jac_xptr("log_none_jac")        logf_args <- list(psi_mode = rep(0, d), rot_mat = diag(d),             hscale = 0, logf = logf, pars = pars, tpars = tpars,             ptpfun = ptpfun, phi_to_theta = phi_to_theta, log_j = log_j,             user_args = user_args)        ru_args <- list(d = d, r = r, tfun = tfun)    }    else if (trans == "BC" & !is.null(phi_to_theta)) {        logf_fun <- cpp_logf_rho_3        a_obj_fun <- cpp_a_obj_2        lower_box_fun <- cpp_lower_box_2        upper_box_fun <- cpp_upper_box_2        ru_fun <- ru_cpp_3        con <- lambda * gm^(lambda - 1)        tpars <- list(which_lam = which_lam - 1, lambda = lambda,             gm = gm, con = con)        tfun <- create_trans_xptr("case_3")        if (all(lambda != 0)) {            ptpfun <- create_psi_to_phi_xptr("no_zero")        }        else {            ptpfun <- create_psi_to_phi_xptr("has_zero")        }        if (is.null(log_j)) {            log_j <- create_log_jac_xptr("case_3")        }        logf_args <- list(psi_mode = rep(0, d), rot_mat = diag(d),             hscale = 0, logf = logf, pars = pars, tpars = tpars,             ptpfun = ptpfun, phi_to_theta = phi_to_theta, log_j = log_j,             user_args = user_args)        ru_args <- list(d = d, r = r, tfun = tfun)    }    else {        logf_fun <- cpp_logf_rho_4        a_obj_fun <- cpp_a_obj_2        lower_box_fun <- cpp_lower_box_2        upper_box_fun <- cpp_upper_box_2        ru_fun <- ru_cpp_4        tpars <- list()        tfun <- create_trans_xptr("case_4")        ptpfun <- create_psi_to_phi_xptr("no_trans")        if (is.null(log_j)) {            log_j <- create_log_jac_xptr("case_4")        }        logf_args <- list(psi_mode = rep(0, d), rot_mat = diag(d),             hscale = 0, logf = logf, pars = pars, tpars = tpars,             ptpfun = ptpfun, phi_to_theta = phi_to_theta, log_j = log_j,             user_args = user_args)        ru_args <- list(d = d, r = r, tfun = tfun)    }    logf_args$hscale <- do.call(logf_fun, c(list(rho = init_psi),         logf_args))    if (is.infinite(logf_args$hscale)) {        stop("The target density is zero at initial parameter values")    }    ru_args <- c(ru_args, logf_args)    for_find_a <- list(init_psi = init_psi, lower = lower, upper = upper,         algor = a_algor, method = a_method, control = a_control,         a_obj_fun = a_obj_fun, ru_args = ru_args, shoof = shoof)    temp <- do.call("cpp_find_a", for_find_a)    check_finite <- do.call(logf_fun, c(list(rho = temp$par),         logf_args))    if (!is.finite(check_finite)) {        stop(paste("The target log-density is not finite at its mode: mode = ",             paste(temp$par, collapse = ","), ",\n               function value = ",             check_finite, ".", sep = ""))    }    ru_args$hscale <- check_finite + logf_args$hscale    logf_args$hscale <- ru_args$hscale    a_box <- 1    f_mode <- temp$par    vals[1, ] <- rep(0, d)    conv[1] <- temp$convergence    pos_def <- TRUE    if (inherits(temp$hessian, "try-error")) {        pos_def <- FALSE    }    else {        hess_mat <- temp$hessian        e_vals <- eigen(hess_mat, symmetric = TRUE, only.values = TRUE)$values        if (any(e_vals < 1e-06)) {            pos_def <- FALSE        }    }    if (!pos_def) {        warning("The Hessian of the target log-density at its mode is not positive\n            definite. This may not be a problem, but it may be that a mode\n            at/near a parameter boundary has been found and/or that the target\n            function is unbounded.",             immediate. = TRUE, noBreaks. = TRUE)        if (trans != "BC") {            cat("  It might be worth using the option trans = ``BC''.",                 "\n")        }        if (rotate) {            rotate <- FALSE            warning("rotate has been changed to FALSE.", immediate. = TRUE)        }    }    if (rotate) {        rot_mat <- solve(t(chol(hess_mat)))        rot_mat <- rot_mat/exp(-mean(log(e_vals))/2)    }    ru_args$rot_mat <- t(rot_mat)    ru_args$psi_mode <- f_mode    logf_args$rot_mat <- t(rot_mat)    logf_args$psi_mode <- f_mode    if (rotate) {        lower <- rep(-Inf, d)        upper <- rep(Inf, d)    }    for_find_bs <- list(lower = lower, upper = upper, ep = ep,         vals = vals, conv = conv, algor = b_algor, method = b_method,         control = b_control, lower_box_fun = lower_box_fun, upper_box_fun = upper_box_fun,         ru_args = ru_args, shoof = shoof)    temp <- do.call("cpp_find_bs", for_find_bs)    vals <- temp$vals    conv <- temp$conv    l_box <- temp$l_box    u_box <- temp$u_box    box_args <- list(n = n, a_box = a_box, l_box = l_box, u_box = u_box)    ru_args <- c(box_args, ru_args)    ru_args$tfun <- NULL    res <- do.call(ru_fun, ru_args)    res$pa <- n/res$ntry    res$ntry <- NULL    colnames(res$sim_vals) <- var_names    colnames(res$sim_vals_rho) <- paste("rho[", 1:d, "]", sep = "")    box <- c(a_box, l_box, u_box)    res$box <- cbind(box, vals, conv)    bs <- paste(paste("b", 1:d, sep = ""), rep(c("minus", "plus"),         each = d), sep = "")    rownames(res$box) <- c("a", bs)    if (any(conv != 0)) {        warning("One or more convergence indicators are non-zero.",             immediate. = TRUE)        print(res$box)    }    res$d <- d    pars$hscale <- logf_args$hscale    res$logf <- cpp_logf_scaled    res$logf_args <- list(logf = logf, pars = pars)    res$logf_rho <- logf_fun    res$logf_rho_args <- logf_args    res$f_mode <- f_mode    res$call <- Call    class(res) <- "ru"    return(res)})(logf = <pointer: 9595970>, pars = list(data = c(2.6115, 1.1285, 5.5985, 0.0745000000000005, 2.8115, 1.2045, 2.1265, 0.503500000000001, 1.0695, 1.8315, 0.00450000000000017, 4.0975, 1.5655, 0.2115, 2.4095, 0.7045, 10.6805, 2.9135, 1.1075, 0.7385, 0.641500000000001, 6.4205, 1.1215, 3.3755, 3.0515, 1.0125, 0.8895, 0.575500000000001, 0.6135, 2.8415, 1.6465, 2.0955, 0.1935, 0.2305, 0.5345, 1.1715, 1.3475, 1.3475, 0.1175, 3.0385, 0.931500000000001, 0.676500000000001, 0.5185, 2.9095, 0.0705000000000005, 0.6795, 0.362500000000001, 0.194500000000001, 2.3705, 0.487500000000001, 0.8475, 1.8715, 1.7815, 3.6445, 0.875500000000001, 1.4415, 0.9375, 0.1695, 0.4175, 0.2135, 0.7845, 1.4175, 0.8455, 0.1235, 1.9925, 0.5155, 0.343500000000001, 1.2965, 3.0715, 0.7895, 0.1475, 0.726500000000001, 1.3525, 2.9375, 3.2575, 1.8225, 0.814500000000001, 8.9805, 5.5295, 0.6755, 1.3745, 0.439500000000001, 0.4385, 0.697500000000001, 3.6445, 1.4795, 2.1765, 1.7185, 2.1605, 1.3915, 1.6725, 0.681500000000001, 3.6735, 0.214500000000001, 3.5415, 2.0035, 6.7115, 5.1605, 1.6605, 2.2885, 0.4815, 1.6245, 3.2365, 4.1935, 0.5735, 0.1445, 8.5515, 0.0225000000000004, 12.2225, 5.6065), m = 110L, xm = 12.2225, sum_gp = 214.27, prior = "gp_flat",     min_xi = -1, max_xi = Inf, trendsd = 0), d = 2L, lower = c(0, -1), upper = c(Inf, Inf), var_names = c("sigma[u]", "xi"), init = c(1.75108600751281, 0.101175043810632), n = 1000, trans = "none", rotate = TRUE,     a_control = list(parscale = c(0.245394195185821, 0.103154683612946    )))
 4: do.call(rust::ru_rcpp, for_ru_rcpp)
 5: rpost_rcpp(n = n, model = "gp", prior = fp, thresh = u, data = gom)
 6: microbenchmark(rpost = rpost(n = n, model = "gp", prior = fp,     thresh = u, data = gom), rpost_rcpp = rpost_rcpp(n = n, model = "gp",     prior = fp, thresh = u, data = gom))
 7: eval(expr, envir, enclos)
 8: eval(expr, envir, enclos)
 9: withVisible(eval(expr, envir, enclos))
10: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler,     error = eHandler, message = mHandler)
11: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir,     enclos)), warning = wHandler, error = eHandler, message = mHandler))
12: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr,     envir, enclos)), warning = wHandler, error = eHandler, message = mHandler)))
13: 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)
14: evaluate::evaluate(...)
15: evaluate(code, envir = env, new_device = FALSE, keep_warning = !isFALSE(options$warning),     keep_message = !isFALSE(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))
16: 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 (is.numeric(options$error)) options$error else {        if (options$error && options$include)             0L        else 2L    }, output_handler = knit_handlers(options$render, options)))
17: eng_r(options)
18: block_exec(params)
19: call_block(x)
20: process_group.block(group)
21: process_group(group)
22: 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"),             ") ")    })
23: process_file(text, output)
24: knit(input, text = text, envir = envir, quiet = quiet)
25: (if (grepl("\\.[Rr]md$", file)) knit2html else if (grepl("\\.[Rr]rst$",     file)) knit2pandoc else knit)(file, encoding = encoding,     quiet = quiet, envir = globalenv(), ...)
26: vweave(...)
27: engine$weave(file, quiet = quiet, encoding = enc)
28: doTryCatch(return(expr), name, parentenv, handler)
29: tryCatchOne(expr, names, parentenv, handlers[[1L]])
30: tryCatchList(expr, classes, parentenv, handlers)
31: 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)))})
32: tools:::.buildOneVignette("revdbayes-b-using-rcpp-vignette.Rmd",     "/home/ripley/R/packages/tests32/revdbayes.Rcheck/vign_test/revdbayes",     TRUE, FALSE, "revdbayes-b-using-rcpp-vignette", "UTF-8",     "/tmp/RtmpOGaidi/working_dir/RtmpTkaWRl/file175e41b335ed.rds")
An irrecoverable exception occurred. R is aborting now ...
--- re-building ‘revdbayes-c-predictive-vignette.Rmd’ using rmarkdown
Warning in engine$weave(file, quiet = quiet, encoding = enc) :
  Pandoc (>= 1.12.3) not available. Falling back to R Markdown v1.
--- finished re-building ‘revdbayes-c-predictive-vignette.Rmd’

Segmentation Fault - core dumped
--- re-building ‘revdbayes-d-kgaps-vignette.Rmd’ using rmarkdown
Warning in engine$weave(file, quiet = quiet, encoding = enc) :
  Pandoc (>= 1.12.3) not available. Falling back to R Markdown v1.

 *** caught segfault ***
address 4, cause 'memory not mapped'

Traceback:
 1: (function (rho, psi_mode, rot_mat, hscale, logf, pars, tpars,     ptpfun, phi_to_theta, log_j, user_args) {    .Call(`_rust_cpp_logf_rho_4`, rho, psi_mode, rot_mat, hscale,         logf, pars, tpars, ptpfun, phi_to_theta, log_j, user_args)})(rho = -0.490213005141577, psi_mode = 0, rot_mat = 1, hscale = 0,     logf = <pointer: 8ab45a8>, pars = list(N0 = 184, N1 = 104L,         sum_qs = 254.547684865238, alpha = 1, beta = 1), tpars = list(),     ptpfun = <pointer: 951ff90>, phi_to_theta = <pointer: 8ab4598>,     log_j = <pointer: 951fee0>, user_args = list())
 2: do.call(logf_fun, c(list(rho = init_psi), logf_args))
 3: (function (logf, ..., n = 1, d = 1, init = NULL, trans = c("none",     "BC", "user"), phi_to_theta = NULL, log_j = NULL, user_args = list(),     lambda = rep(1L, d), lambda_tol = 1e-06, gm = NULL, rotate = ifelse(d ==         1, FALSE, TRUE), lower = rep(-Inf, d), upper = rep(Inf,         d), r = 1/2, ep = 0L, a_algor = if (d == 1) "nlminb" else "optim",     b_algor = c("nlminb", "optim"), a_method = c("Nelder-Mead",         "BFGS", "CG", "L-BFGS-B", "SANN", "Brent"), b_method = c("Nelder-Mead",         "BFGS", "CG", "L-BFGS-B", "SANN", "Brent"), a_control = list(),     b_control = list(), var_names = NULL, shoof = 0.2) {    Call <- match.call(expand.dots = TRUE)    if (shoof < 0 || shoof > 1) {        stop("''shoof'' must be in [0, 1]")    }    is_pointer <- (class(logf) == "externalptr")    if (!is_pointer) {        stop("logf must be an external pointer to a function")    }    pars <- list(...)    list_depth <- function(x) {        ifelse(is.list(x), 1L + max(sapply(x, list_depth)), 0L)    }    if (length(pars) > 0) {        pars_depth <- list_depth(pars)    }    else {        pars_depth <- 0    }    if (pars_depth > 1) {        par_names <- names(pars)        pars <- unlist(pars, recursive = FALSE)        if (!is.null(par_names)) {            keep_name <- nchar(par_names) + 2            names(pars) <- substring(names(pars), keep_name)        }    }    if (r < 0) {        stop("r must be non-negative")    }    a_algor <- match.arg(a_algor, c("optim", "nlminb"))    a_method <- match.arg(a_method)    b_algor <- match.arg(b_algor)    b_method <- match.arg(b_method)    if (any(upper <= lower)) {        stop("upper must be greater than lower, componentwise.")    }    trans <- match.arg(trans)    if (is.null(gm)) {        gm <- rep(1, d)    }    if (trans == "BC") {        lambda_type <- "numeric"        if (is.list(lambda)) {            lambda_type <- "list"            if (is.null(lambda$lambda)) {                stop("The list lambda must contain the object lambda$lambda")            }            if (!is.null(lambda$gm)) {                gm <- lambda$gm            }            if (!is.null(lambda$init_psi)) {                init <- lambda$init_psi            }            if (a_algor == "optim" & is.null(a_control$parscale)) {                a_control <- c(a_control, list(parscale = lambda$sd_psi))            }            if (!is.null(lambda$phi_to_theta)) {                phi_to_theta <- lambda$phi_to_theta            }            if (!is.null(lambda$log_j)) {                log_j <- lambda$log_j            }            if (!is.null(lambda$user_args)) {                user_args <- lambda$user_args            }            lambda <- lambda$lambda        }        lambda <- ifelse(abs(lambda) < lambda_tol, 0L, lambda)        if (!is.vector(lambda)) {            stop("lambda must be a numeric vector")        }        if (!(length(lambda) %in% c(1, d))) {            if (lambda_type == "numeric") {                stop("lambda must be a numeric vector of length d")            }            if (lambda_type == "list") {                stop("lambda$lambda must be a numeric vector of length d")            }        }        if (length(lambda) == 1) {            lambda <- rep(lambda, d)        }        if (any(upper <= 0)) {            stop("when trans = ``BC'' all elements of upper must be positive")        }        lower <- pmax(0, lower)        lower <- ifelse(lambda == 0, gm * log(lower), (lower^lambda -             1)/(lambda * gm^(lambda - 1)))        upper <- ifelse(lambda == 0, gm * log(upper), (upper^lambda -             1)/(lambda * gm^(lambda - 1)))    }    if (d == 1 & a_algor == "optim" & any(is.infinite(c(lower,         upper)))) {        a_algor = "nlminb"        warning("For d = 1 finite lower and upper bounds must be supplied when\n            using a_algor = `optim'.  a_algor has been changed to `nlminb'")    }    if (d == 1 & b_algor == "optim" & any(is.infinite(c(lower,         upper)))) {        b_algor = "nlminb"        warning("For d = 1 finite lower and upper bounds must be supplied when\n            using b_algor = `optim'.  b_algor has been changed to `nlminb'")    }    if (b_algor == "optim") {        if (b_method == "BFGS" | b_method == "CG") {            warning("Using optim with b_method==`BFGS' or `CG' can produce the error\n              message `non-finite finite-difference value'.  If you really want\n              to use BFGS or CG try setting ep to be positive but small, e.g.\n              ep=0.001.",                 immediate. = TRUE, noBreaks. = TRUE)        }    }    if (d == 1) {        a_method <- "Brent"        b_method <- "Brent"    }    if (d == 1) {        which_lam <- 1L    }    else {        which_lam <- which(lambda != 1L)    }    if (is.null(init)) {        init <- rep(1, d)        warning("No initial estimate of the mode given: a vector of ones has\n            been used",             noBreaks. = TRUE)    }    len_init <- length(init)    if (len_init == 1 & d > 1) {        init <- rep(init, length.out = d)        warning("d > 1 but init has length 1: a d-vector of inits has been used")    }    if (len_init != d & len_init != 1) {        stop("the length of init is incompatible with d")    }    if (d == 1 & rotate) {        rotate <- FALSE        warning("rotation is not relevant when d=1: no rotation is used")    }    ep <- abs(ep)    vals <- matrix(NA, ncol = d, nrow = 2 * d + 1)    colnames(vals) <- paste("vals", 1:d, sep = "")    conv <- rep(NA, 2 * d + 1)    big_val <- Inf    hscale <- 0    psi_mode <- rep(0, d)    is_pointer <- (class(phi_to_theta) == "externalptr")    if (trans == "none" & is_pointer) {        warning("phi_to_theta() not used when trans = ``none'': identity fn used")    }    if (!is_pointer & !is.null(phi_to_theta)) {        stop("phi_to_theta must be an external pointer to a function or NULL")    }    if (trans == "user" & is.null(phi_to_theta)) {        stop("When trans = ``user'' phi_to_theta must be supplied")    }    is_pointer <- (class(log_j) == "externalptr")    if (!is_pointer & !is.null(log_j)) {        stop("log_j must be an external pointer to a function or NULL")    }    rot_mat <- diag(d)    init_psi <- init    if (trans == "none") {        logf_fun <- cpp_logf_rho        a_obj_fun <- cpp_a_obj        lower_box_fun <- cpp_lower_box        upper_box_fun <- cpp_upper_box        ru_fun <- ru_cpp        logf_args <- list(psi_mode = rep(0, d), rot_mat = diag(d),             hscale = 0, logf = logf, pars = pars)        ru_args <- list(d = d, r = r)    }    else if (trans == "BC" & is.null(phi_to_theta)) {        logf_fun <- cpp_logf_rho_2        a_obj_fun <- cpp_a_obj_2        lower_box_fun <- cpp_lower_box_2        upper_box_fun <- cpp_upper_box_2        ru_fun <- ru_cpp_2        con <- lambda * gm^(lambda - 1)        tpars <- list(which_lam = which_lam - 1, lambda = lambda,             gm = gm, con = con)        tfun <- create_trans_xptr("case_2")        if (all(lambda != 0)) {            ptpfun <- create_psi_to_phi_xptr("no_zero")        }        else {            ptpfun <- create_psi_to_phi_xptr("has_zero")        }        phi_to_theta <- null_phi_to_theta_xptr("no_trans")        log_j <- create_log_jac_xptr("log_none_jac")        logf_args <- list(psi_mode = rep(0, d), rot_mat = diag(d),             hscale = 0, logf = logf, pars = pars, tpars = tpars,             ptpfun = ptpfun, phi_to_theta = phi_to_theta, log_j = log_j,             user_args = user_args)        ru_args <- list(d = d, r = r, tfun = tfun)    }    else if (trans == "BC" & !is.null(phi_to_theta)) {        logf_fun <- cpp_logf_rho_3        a_obj_fun <- cpp_a_obj_2        lower_box_fun <- cpp_lower_box_2        upper_box_fun <- cpp_upper_box_2        ru_fun <- ru_cpp_3        con <- lambda * gm^(lambda - 1)        tpars <- list(which_lam = which_lam - 1, lambda = lambda,             gm = gm, con = con)        tfun <- create_trans_xptr("case_3")        if (all(lambda != 0)) {            ptpfun <- create_psi_to_phi_xptr("no_zero")        }        else {            ptpfun <- create_psi_to_phi_xptr("has_zero")        }        if (is.null(log_j)) {            log_j <- create_log_jac_xptr("case_3")        }        logf_args <- list(psi_mode = rep(0, d), rot_mat = diag(d),             hscale = 0, logf = logf, pars = pars, tpars = tpars,             ptpfun = ptpfun, phi_to_theta = phi_to_theta, log_j = log_j,             user_args = user_args)        ru_args <- list(d = d, r = r, tfun = tfun)    }    else {        logf_fun <- cpp_logf_rho_4        a_obj_fun <- cpp_a_obj_2        lower_box_fun <- cpp_lower_box_2        upper_box_fun <- cpp_upper_box_2        ru_fun <- ru_cpp_4        tpars <- list()        tfun <- create_trans_xptr("case_4")        ptpfun <- create_psi_to_phi_xptr("no_trans")        if (is.null(log_j)) {            log_j <- create_log_jac_xptr("case_4")        }        logf_args <- list(psi_mode = rep(0, d), rot_mat = diag(d),             hscale = 0, logf = logf, pars = pars, tpars = tpars,             ptpfun = ptpfun, phi_to_theta = phi_to_theta, log_j = log_j,             user_args = user_args)        ru_args <- list(d = d, r = r, tfun = tfun)    }    logf_args$hscale <- do.call(logf_fun, c(list(rho = init_psi),         logf_args))    if (is.infinite(logf_args$hscale)) {        stop("The target density is zero at initial parameter values")    }    ru_args <- c(ru_args, logf_args)    for_find_a <- list(init_psi = init_psi, lower = lower, upper = upper,         algor = a_algor, method = a_method, control = a_control,         a_obj_fun = a_obj_fun, ru_args = ru_args, shoof = shoof)    temp <- do.call("cpp_find_a", for_find_a)    check_finite <- do.call(logf_fun, c(list(rho = temp$par),         logf_args))    if (!is.finite(check_finite)) {        stop(paste("The target log-density is not finite at its mode: mode = ",             paste(temp$par, collapse = ","), ",\n               function value = ",             check_finite, ".", sep = ""))    }    ru_args$hscale <- check_finite + logf_args$hscale    logf_args$hscale <- ru_args$hscale    a_box <- 1    f_mode <- temp$par    vals[1, ] <- rep(0, d)    conv[1] <- temp$convergence    pos_def <- TRUE    if (inherits(temp$hessian, "try-error")) {        pos_def <- FALSE    }    else {        hess_mat <- temp$hessian        e_vals <- eigen(hess_mat, symmetric = TRUE, only.values = TRUE)$values        if (any(e_vals < 1e-06)) {            pos_def <- FALSE        }    }    if (!pos_def) {        warning("The Hessian of the target log-density at its mode is not positive\n            definite. This may not be a problem, but it may be that a mode\n            at/near a parameter boundary has been found and/or that the target\n            function is unbounded.",             immediate. = TRUE, noBreaks. = TRUE)        if (trans != "BC") {            cat("  It might be worth using the option trans = ``BC''.",                 "\n")        }        if (rotate) {            rotate <- FALSE            warning("rotate has been changed to FALSE.", immediate. = TRUE)        }    }    if (rotate) {        rot_mat <- solve(t(chol(hess_mat)))        rot_mat <- rot_mat/exp(-mean(log(e_vals))/2)    }    ru_args$rot_mat <- t(rot_mat)    ru_args$psi_mode <- f_mode    logf_args$rot_mat <- t(rot_mat)    logf_args$psi_mode <- f_mode    if (rotate) {        lower <- rep(-Inf, d)        upper <- rep(Inf, d)    }    for_find_bs <- list(lower = lower, upper = upper, ep = ep,         vals = vals, conv = conv, algor = b_algor, method = b_method,         control = b_control, lower_box_fun = lower_box_fun, upper_box_fun = upper_box_fun,         ru_args = ru_args, shoof = shoof)    temp <- do.call("cpp_find_bs", for_find_bs)    vals <- temp$vals    conv <- temp$conv    l_box <- temp$l_box    u_box <- temp$u_box    box_args <- list(n = n, a_box = a_box, l_box = l_box, u_box = u_box)    ru_args <- c(box_args, ru_args)    ru_args$tfun <- NULL    res <- do.call(ru_fun, ru_args)    res$pa <- n/res$ntry    res$ntry <- NULL    colnames(res$sim_vals) <- var_names    colnames(res$sim_vals_rho) <- paste("rho[", 1:d, "]", sep = "")    box <- c(a_box, l_box, u_box)    res$box <- cbind(box, vals, conv)    bs <- paste(paste("b", 1:d, sep = ""), rep(c("minus", "plus"),         each = d), sep = "")    rownames(res$box) <- c("a", bs)    if (any(conv != 0)) {        warning("One or more convergence indicators are non-zero.",             immediate. = TRUE)        print(res$box)    }    res$d <- d    pars$hscale <- logf_args$hscale    res$logf <- cpp_logf_scaled    res$logf_args <- list(logf = logf, pars = pars)    res$logf_rho <- logf_fun    res$logf_rho_args <- logf_args    res$f_mode <- f_mode    res$call <- Call    class(res) <- "ru"    return(res)})(logf = <pointer: 8ab45a8>, pars = list(N0 = 184, N1 = 104L,     sum_qs = 254.547684865238, alpha = 1, beta = 1), n = 1000,     init = -0.490213005141577, trans = "user", phi_to_theta = <pointer: 8ab4598>,     log_j = <pointer: 951fee0>)
 4: do.call(ru_fn, for_ru)
 5: kgaps_post(newlyn, thresh)
 6: eval(expr, envir, enclos)
 7: eval(expr, envir, enclos)
 8: withVisible(eval(expr, envir, enclos))
 9: withCallingHandlers(withVisible(eval(expr, envir, enclos)), warning = wHandler,     error = eHandler, message = mHandler)
10: handle(ev <- withCallingHandlers(withVisible(eval(expr, envir,     enclos)), warning = wHandler, error = eHandler, message = mHandler))
11: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval(expr,     envir, enclos)), warning = wHandler, error = eHandler, message = mHandler)))
12: 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)
13: evaluate::evaluate(...)
14: evaluate(code, envir = env, new_device = FALSE, keep_warning = !isFALSE(options$warning),     keep_message = !isFALSE(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))
15: 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 (is.numeric(options$error)) options$error else {        if (options$error && options$include)             0L        else 2L    }, output_handler = knit_handlers(options$render, options)))
16: eng_r(options)
17: block_exec(params)
18: call_block(x)
19: process_group.block(group)
20: process_group(group)
21: 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"),             ") ")    })
22: process_file(text, output)
23: knit(input, text = text, envir = envir, quiet = quiet)
24: (if (grepl("\\.[Rr]md$", file)) knit2html else if (grepl("\\.[Rr]rst$",     file)) knit2pandoc else knit)(file, encoding = encoding,     quiet = quiet, envir = globalenv(), ...)
25: vweave(...)
26: engine$weave(file, quiet = quiet, encoding = enc)
27: doTryCatch(return(expr), name, parentenv, handler)
28: tryCatchOne(expr, names, parentenv, handlers[[1L]])
29: tryCatchList(expr, classes, parentenv, handlers)
30: 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)))})
31: tools:::.buildOneVignette("revdbayes-d-kgaps-vignette.Rmd", "/home/ripley/R/packages/tests32/revdbayes.Rcheck/vign_test/revdbayes",     TRUE, FALSE, "revdbayes-d-kgaps-vignette", "UTF-8", "/tmp/RtmpOGaidi/working_dir/RtmpTkaWRl/file175e4ebd5717.rds")
An irrecoverable exception occurred. R is aborting now ...
SUMMARY: processing the following files failed:
  ‘revdbayes-b-using-rcpp-vignette.Rmd’
  ‘revdbayes-d-kgaps-vignette.Rmd’

Error: Vignette re-building failed.
Execution halted