Error(s) in re-building vignettes:
  ...
--- re-building ‘mombf.Rnw’ using Sweave
Loading required package: mvtnorm
Loading required package: ncvreg
Loading required package: mgcv
Loading required package: nlme
This is mgcv 1.8-31. For overview type 'help("mgcv-package")'.
Warning in model.matrix.default(mt, mf, contrasts) :
  non-list contrasts argument ignored
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
mombf
 --- call from context --- 
modelSelection(y = y, x = x, center = FALSE, scale = FALSE, priorCoef = priorCoef, 
    priorDelta = priorDelta, priorVar = priorVar)
 --- call from argument --- 
if (class(y) == "formula") {
    formula = y
    splineDegree = 3
    des = createDesign(y, data = data, smoothterms = smoothterms, 
        splineDegree = splineDegree, nknots = nknots)
    x = des$x
    groups = des$groups
    constraints = des$constraints
    typeofvar = des$typeofvar
    if (class(des$y) == "Surv") {
        if (all(des$y[, 1] > 0)) {
            cat("Response type is survival and all its values are >0. Remember that you should log-transform the response prior to running modelSelection\n")
        }
        outcometype = "Survival"
        uncens = as.integer(des$y[, 2])
        y = des$y[, 1]
        ordery = c(which(uncens == 1), which(uncens != 1))
        y = y[ordery]
        x = x[ordery, , drop = FALSE]
        uncens = uncens[ordery]
        if (family != "normal") 
            stop("For survival outcomes only family='normal' is currently implemented")
    }
    else {
        outcometype = "Continuous"
        y = des$y
        uncens = integer(0)
    }
    nlevels = apply(x, 2, function(z) length(unique(z)))
    typeofvar[nlevels == 2] = "factor"
} else {
    if (class(y) == "Surv") {
        outcometype = "Survival"
        uncens = as.integer(y[, 2])
        y = des$y[, 1]
        ordery = c(which(uncens == 1), which(uncens != 1))
        y = y[ordery]
        x = x[ordery, , drop = FALSE]
        uncens = uncens[ordery]
        if (family != "normal") 
            stop("For survival outcomes only family='normal' is currently implemented")
    }
    else {
        outcometype = "Continuous"
        uncens = integer(0)
    }
    formula = splineDegree = NA
    typeofvar = rep("numeric", ncol(x))
}
 --- R stacktrace ---
where 1: modelSelection(y = y, x = x, center = FALSE, scale = FALSE, priorCoef = priorCoef, 
    priorDelta = priorDelta, priorVar = priorVar)
where 2: eval(expr, .GlobalEnv)
where 3: eval(expr, .GlobalEnv)
where 4: withVisible(eval(expr, .GlobalEnv))
where 5: doTryCatch(return(expr), name, parentenv, handler)
where 6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 7: tryCatchList(expr, classes, parentenv, handlers)
where 8: 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)[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))
})
where 9: try(withVisible(eval(expr, .GlobalEnv)), silent = TRUE)
where 10: evalFunc(ce, options)
where 11: tryCatchList(expr, classes, parentenv, handlers)
where 12: tryCatch(evalFunc(ce, options), finally = {
    cat("\n")
    sink()
})
where 13: driver$runcode(drobj, chunk, chunkopts)
where 14: utils::Sweave(...)
where 15: engine$weave(file, quiet = quiet, encoding = enc)
where 16: doTryCatch(return(expr), name, parentenv, handler)
where 17: tryCatchOne(expr, names, parentenv, handlers[[1L]])
where 18: tryCatchList(expr, classes, parentenv, handlers)
where 19: 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)
    }
    outputs <- c(outputs, output)
}, error = function(e) {
    thisOK <<- FALSE
    fails <<- c(fails, file)
    message(gettextf("Error: processing vignette '%s' failed with diagnostics:\n%s", 
        file, conditionMessage(e)))
})
where 20: tools:::buildVignettes(dir = "/home/hornik/tmp/R.check/r-devel-gcc/Work/PKGS/mombf.Rcheck/vign_test/mombf", 
    ser_elibs = "/home/hornik/tmp/scratch/RtmpIogNAc/file5a707b38dce3.rds")

 --- value of length: 2 type: logical ---
[1] FALSE FALSE
 --- function from context --- 
function (y, x, data, smoothterms, nknots = 9, groups = 1:ncol(x), 
    constraints, center = TRUE, scale = TRUE, enumerate, includevars = rep(FALSE, 
        ncol(x)), maxvars, niter = 5000, thinning = 1, burnin = round(niter/10), 
    family = "normal", priorCoef, priorGroup, priorDelta = modelbbprior(1, 
        1), priorConstraints = priorDelta, priorVar = igprior(0.01, 
        0.01), priorSkew = momprior(tau = 0.348), phi, deltaini = rep(FALSE, 
        ncol(x)), initSearch = "greedy", method = "auto", hess = "asymp", 
    optimMethod = "CDA", B = 10^5, XtXprecomp = ifelse(ncol(x) < 
        10^4, TRUE, FALSE), verbose = TRUE) 
{
    if (class(y) == "formula") {
        formula = y
        splineDegree = 3
        des = createDesign(y, data = data, smoothterms = smoothterms, 
            splineDegree = splineDegree, nknots = nknots)
        x = des$x
        groups = des$groups
        constraints = des$constraints
        typeofvar = des$typeofvar
        if (class(des$y) == "Surv") {
            if (all(des$y[, 1] > 0)) {
                cat("Response type is survival and all its values are >0. Remember that you should log-transform the response prior to running modelSelection\n")
            }
            outcometype = "Survival"
            uncens = as.integer(des$y[, 2])
            y = des$y[, 1]
            ordery = c(which(uncens == 1), which(uncens != 1))
            y = y[ordery]
            x = x[ordery, , drop = FALSE]
            uncens = uncens[ordery]
            if (family != "normal") 
                stop("For survival outcomes only family='normal' is currently implemented")
        }
        else {
            outcometype = "Continuous"
            y = des$y
            uncens = integer(0)
        }
        nlevels = apply(x, 2, function(z) length(unique(z)))
        typeofvar[nlevels == 2] = "factor"
    }
    else {
        if (class(y) == "Surv") {
            outcometype = "Survival"
            uncens = as.integer(y[, 2])
            y = des$y[, 1]
            ordery = c(which(uncens == 1), which(uncens != 1))
            y = y[ordery]
            x = x[ordery, , drop = FALSE]
            uncens = uncens[ordery]
            if (family != "normal") 
                stop("For survival outcomes only family='normal' is currently implemented")
        }
        else {
            outcometype = "Continuous"
            uncens = integer(0)
        }
        formula = splineDegree = NA
        typeofvar = rep("numeric", ncol(x))
    }
    call = list(formula = formula, smoothterms = NULL, splineDegree = splineDegree, 
        nknots = nknots)
    if (!missing(smoothterms)) 
        call$smoothterms = smoothterms
    p = ncol(x)
    n = length(y)
    if (nrow(x) != length(y)) 
        stop("nrow(x) must be equal to length(y)")
    if (any(is.na(y))) 
        stop("y contains NAs, this is currently not supported, please remove the NAs")
    if (length(includevars) != ncol(x) | (!is.logical(includevars))) 
        stop("includevars must be a logical vector of length ncol(x)")
    if (missing(maxvars)) 
        maxvars = ifelse(family == "auto", p + 2, p)
    if (maxvars <= sum(includevars)) 
        stop("maxvars must be >= sum(includevars)")
    if (missing(priorCoef)) {
        defaultprior = defaultmom(outcometype = outcometype, 
            family = family)
        priorCoef = defaultprior$priorCoef
        priorVar = defaultprior$priorVar
    }
    if (missing(priorGroup)) {
        if (length(groups) == length(unique(groups))) {
            priorGroup = priorCoef
        }
        else {
            priorGroup = groupzellnerprior(tau = n)
        }
    }
    tmp = codeGroupsAndConstraints(p = p, groups = groups, constraints = constraints)
    ngroups = tmp$ngroups
    constraints = tmp$constraints
    invconstraints = tmp$invconstraints
    nvaringroup = tmp$nvaringroup
    groups = tmp$groups
    if (missing(enumerate)) 
        enumerate = ifelse(ngroups < 15, TRUE, FALSE)
    if (!is.vector(y)) {
        y <- as.double(as.vector(y))
    }
    else {
        y <- as.double(y)
    }
    if (!is.matrix(x)) 
        x <- as.matrix(x)
    mx = colMeans(x)
    sx = sqrt(colMeans(x^2) - mx^2) * sqrt(n/(n - 1))
    ct = (sx == 0)
    if (any(is.na(ct))) 
        stop("x contains NAs, this is currently not supported, please remove the NAs")
    if (sum(ct) > 1) 
        stop("There are >1 constant columns in x (e.g. two intercepts)")
    if (!center) {
        my = 0
        mx = rep(0, p)
    }
    else {
        my = mean(y)
    }
    if (!scale) {
        sy = 1
        sx = rep(1, p)
    }
    else {
        sy = sd(y)
    }
    mx[typeofvar == "factor"] = 0
    sx[typeofvar == "factor"] = 1
    ystd = (y - my)/sy
    xstd = x
    xstd[, !ct] = t((t(x[, !ct]) - mx[!ct])/sx[!ct])
    if (missing(phi)) {
        knownphi <- as.integer(0)
        phi <- double(0)
    }
    else {
        knownphi <- as.integer(1)
        phi <- as.double(phi)
    }
    stdconstants = rbind(c(my, sy), cbind(mx, sx))
    colnames(stdconstants) = c("shift", "scale")
    if (missing(deltaini)) {
        deltaini = as.integer(which(includevars))
        ndeltaini = as.integer(length(deltaini))
    }
    else {
        if (length(deltaini) != p) 
            stop("deltaini must be of length ncol(x)")
        if (!is.logical(deltaini)) {
            stop("deltaini must be of type logical")
        }
        else {
            ndeltaini <- as.integer(sum(deltaini | includevars))
            deltaini <- as.integer(which(deltaini | includevars) - 
                1)
        }
    }
    method = formatmsMethod(method = method, priorCoef = priorCoef, 
        knownphi = knownphi)
    hess <- as.integer(ifelse(hess == "asympDiagAdj", 2, 1))
    optimMethod <- as.integer(ifelse(optimMethod == "CDA", 2, 
        1))
    niter <- as.integer(niter)
    burnin <- as.integer(burnin)
    thinning <- as.integer(thinning)
    B <- as.integer(B)
    sumy2 <- as.double(sum(ystd^2))
    ytX <- as.vector(matrix(ystd, nrow = 1) %*% xstd)
    if (XtXprecomp) {
        XtX = t(xstd) %*% xstd
        hasXtX = as.logical(TRUE)
    }
    else {
        XtX = double(0)
        hasXtX = as.logical(FALSE)
    }
    tmp = formatmsPriors(priorCoef = priorCoef, priorGroup = priorGroup, 
        priorVar = priorVar, priorSkew = priorSkew, priorDelta = priorDelta, 
        priorConstraints = priorConstraints)
    r = tmp$r
    prior = tmp$prior
    priorgr = tmp$priorgr
    tau = tmp$tau
    taugroup = tmp$taugroup
    alpha = tmp$alpha
    lambda = tmp$lambda
    taualpha = tmp$taualpha
    fixatanhalpha = tmp$fixatanhalpha
    prDelta = tmp$prDelta
    prDeltap = tmp$prDeltap
    parprDeltap = tmp$parprDeltap
    prConstr = tmp$prConstr
    prConstrp = tmp$prConstrp
    parprConstrp = tmp$parprConstrp
    if (family == "auto") {
        familyint = 0
        familygreedy = 1
    }
    else if (family == "normal") {
        familyint = familygreedy = ifelse(length(uncens) == 0, 
            1, 11)
    }
    else if (family == "twopiecenormal") {
        familyint = 2
        familygreedy = 1
    }
    else if (family == "laplace") {
        familyint = 3
        familygreedy = 1
    }
    else if (family == "twopiecelaplace") {
        familyint = 4
        familygreedy = 1
    }
    else stop("family not available")
    familyint = as.integer(familyint)
    familygreedy = as.integer(familygreedy)
    if (!is.null(colnames(xstd))) {
        nn <- colnames(xstd)
    }
    else {
        nn <- paste("x", 1:ncol(xstd), sep = "")
    }
    if (!enumerate) {
        includevars <- as.integer(includevars)
        if (familyint == 0) {
            postMode <- rep(as.integer(0), p + 2)
        }
        else {
            postMode <- rep(as.integer(0), p)
        }
        postModeProb <- double(1)
        if (initSearch == "greedy") {
            niterGreed <- as.integer(100)
            ans = .Call("greedyVarSelCI", knownphi, familygreedy, 
                prior, priorgr, niterGreed, ndeltaini, deltaini, 
                includevars, n, p, ystd, uncens, sumy2, xstd, 
                hasXtX, XtX, ytX, method, hess, optimMethod, 
                B, alpha, lambda, phi, tau, taugroup, taualpha, 
                fixatanhalpha, r, prDelta, prDeltap, parprDeltap, 
                prConstr, prConstrp, parprConstrp, groups, ngroups, 
                nvaringroup, constraints, invconstraints, as.integer(verbose))
            postMode <- ans[[1]]
            postModeProb <- ans[[2]]
            if (familyint == 0) {
                postMode <- as.integer(c(postMode, 0, 0))
                postModeProb <- as.double(postModeProb - 2 * 
                  log(2))
            }
            postMode[includevars == 1] <- TRUE
            ndeltaini <- as.integer(sum(postMode))
            deltaini <- as.integer(which(as.logical(postMode)) - 
                1)
        }
        else if (initSearch == "SCAD") {
            if (verbose) 
                cat("Initializing via SCAD cross-validation...")
            deltaini <- rep(TRUE, ncol(xstd))
            cvscad <- cv.ncvreg(X = xstd[, !ct], y = ystd - mean(ystd), 
                family = "gaussian", penalty = "SCAD", nfolds = 10, 
                dfmax = 1000, max.iter = 10^4)
            deltaini[!ct] <- ncvreg(X = xstd[, !ct], y = ystd - 
                mean(ystd), penalty = "SCAD", dfmax = 1000, lambda = rep(cvscad$lambda[cvscad$cv], 
                2))$beta[-1, 1] != 0
            deltaini[includevars == 1] <- TRUE
            ndeltaini <- as.integer(sum(deltaini))
            deltaini <- as.integer(which(deltaini) - 1)
            if (verbose) 
                cat(" Done\n")
        }
        ans <- .Call("modelSelectionGibbsCI", postMode, postModeProb, 
            knownphi, familyint, prior, priorgr, niter, thinning, 
            burnin, ndeltaini, deltaini, includevars, n, p, ystd, 
            uncens, sumy2, as.double(xstd), hasXtX, XtX, ytX, 
            method, hess, optimMethod, B, alpha, lambda, phi, 
            tau, taugroup, taualpha, fixatanhalpha, r, prDelta, 
            prDeltap, parprDeltap, prConstr, prConstrp, parprConstrp, 
            groups, ngroups, nvaringroup, constraints, invconstraints, 
            as.integer(verbose))
        postSample <- matrix(ans[[1]], ncol = ifelse(familyint != 
            0, p, p + 2))
        margpp <- ans[[2]]
        postMode <- ans[[3]]
        postModeProb <- ans[[4]]
        postProb <- ans[[5]]
    }
    else {
        if (verbose) 
            cat("Enumerating models...\n")
        nincludevars = sum(includevars)
        nvars = ifelse(familyint == 0, ncol(xstd) + 2 - nincludevars, 
            ncol(xstd) - nincludevars)
        if (familyint == 0) {
            includeenum = c(includevars[groups + 1], FALSE, FALSE)
        }
        else {
            includeenum = includevars[groups + 1]
        }
        models = listmodels(vars2list = 1:ngroups, includevars = includeenum, 
            constraints = sapply(constraints, function(z) z + 
                1), nvaringroup = nvaringroup, maxvars = maxvars)
        if (familyint == 0) 
            models = rbind(cbind(models, FALSE, FALSE), cbind(models, 
                FALSE, TRUE), cbind(models, TRUE, FALSE), cbind(models, 
                TRUE, TRUE))
        nmodels = as.integer(nrow(models))
        models = as.integer(models)
        includevars = as.integer(includevars)
        ans = .Call("modelSelectionEnumCI", nmodels, models, 
            knownphi, familyint, prior, priorgr, n, p, ystd, 
            uncens, sumy2, as.double(xstd), hasXtX, XtX, ytX, 
            method, hess, optimMethod, B, alpha, lambda, phi, 
            tau, taugroup, taualpha, fixatanhalpha, r, prDelta, 
            prDeltap, parprDeltap, prConstr, prConstrp, parprConstrp, 
            groups, ngroups, nvaringroup, constraints, invconstraints, 
            as.integer(verbose))
        postMode <- ans[[1]]
        postModeProb <- ans[[2]]
        postProb <- ans[[3]]
        postSample <- matrix(nrow = 0, ncol = ifelse(familyint != 
            0, p, p + 2))
        models <- matrix(models, nrow = nmodels)
        pp <- exp(postProb - postModeProb)
        pp <- matrix(pp/sum(pp), ncol = 1)
        margpp <- as.vector(t(models) %*% pp)
        modelid = apply(models[, 1:ncol(xstd), drop = FALSE] == 
            1, 1, function(z) paste(which(z), collapse = ","))
        if (familyint == 0) {
            modelfam = models[, ncol(xstd) + 1] + 2 * models[, 
                ncol(xstd) + 2]
            margpp = c(margpp[1:ncol(xstd)], sum(pp[modelfam == 
                0]), sum(pp[modelfam == 1]), sum(pp[modelfam == 
                2]), sum(pp[modelfam == 3]))
            modeltxt = ifelse(modelfam == 0, "normal", ifelse(modelfam == 
                1, "twopiecenormal", ifelse(modelfam == 2, "laplace", 
                "twopiecelaplace")))
            models = data.frame(modelid = modelid, family = modeltxt, 
                pp = pp)
        }
        else {
            models = data.frame(modelid = modelid, family = family, 
                pp = pp)
        }
        models = models[order(models$pp, decreasing = TRUE), 
            ]
    }
    if (familyint != 0) {
        colnames(postSample) <- names(postMode) <- names(margpp) <- nn
    }
    else {
        colnames(postSample) <- names(postMode) <- c(nn, "asymmetry", 
            "laplace")
        names(margpp) <- c(nn, "family.normal", "family.tpnormal", 
            "family.laplace", "family.tplaplace")
    }
    priors = list(priorCoef = priorCoef, priorGroup = priorGroup, 
        priorDelta = priorDelta, priorConstraints = priorConstraints, 
        priorVar = priorVar, priorSkew = priorSkew)
    if (length(uncens) > 0) {
        ystd[ordery] = ystd
        uncens[ordery] = uncens
        ystd = Surv(time = ystd, event = uncens)
        xstd[ordery, ] = xstd
    }
    names(constraints) = paste("group", 0:(length(constraints) - 
        1))
    ans <- list(postSample = postSample, margpp = margpp, postMode = postMode, 
        postModeProb = postModeProb, postProb = postProb, family = family, 
        p = ncol(xstd), enumerate = enumerate, priors = priors, 
        ystd = ystd, xstd = xstd, groups = groups, constraints = constraints, 
        stdconstants = stdconstants, outcometype = outcometype, 
        call = call)
    if (enumerate) {
        ans$models = models
    }
    new("msfit", ans)
}
<bytecode: 0x55aa73e0e728>
<environment: namespace:mombf>
 --- function search by body ---
Function modelSelection in namespace mombf has this body.
 ----------- END OF FAILURE REPORT -------------- 
Fatal error: the condition has length > 1