Running examples in ‘EMVS-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: EMVS
> ### Title: Bayesian Variable Selection using EM Algorithm
> ### Aliases: EMVS
> ### Keywords: Bayesian variable selection Spike and slab
> 
> ### ** Examples
> 
> # Linear regression with p>n variables
> library(EMVS)
> 
> n = 100
> p = 1000
> X = matrix(rnorm(n * p), n, p)
> beta = c(1.5, 2, 2.5, rep(0, p-3))
> Y = X[,1] * beta[1] + X[,2] * beta[2] + X[,3] * beta[3] + rnorm(n)
> 
> # conjugate prior on regression coefficients and variance
> v0 = seq(0.1, 2, length.out = 20)
> v1 = 1000
> beta_init = rep(1, p)
> sigma_init = 1
> a = b = 1
> epsilon = 10^{-5}
> 
> result = EMVS(Y, X, v0 = v0, v1 = v1, type = "betabinomial", 
+ independent = FALSE, beta_init = beta_init, sigma_init = sigma_init,
+ epsilon = epsilon, a = a, b = b)
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
EMVS
 --- call from context --- 
EMVS(Y, X, v0 = v0, v1 = v1, type = "betabinomial", independent = FALSE, 
    beta_init = beta_init, sigma_init = sigma_init, epsilon = epsilon, 
    a = a, b = b)
 --- call from argument --- 
if (class(X) != "matrix") {
    tmp <- try(X <- model.matrix(~0 + ., data = X), silent = TRUE)
    if (class(tmp)[1] == "try-error") 
        stop("X must be a matrix or able to be coerced to a matrix")
}
 --- R stacktrace ---
where 1: EMVS(Y, X, v0 = v0, v1 = v1, type = "betabinomial", independent = FALSE, 
    beta_init = beta_init, sigma_init = sigma_init, epsilon = epsilon, 
    a = a, b = b)

 --- value of length: 2 type: logical ---
[1] FALSE  TRUE
 --- function from context --- 
function (Y, X, v0, v1, type = c("betabinomial", "fixed"), independent = TRUE, 
    beta_init, sigma_init = 1, epsilon = 10^(-5), temperature, 
    theta = 0.5, a = 1, b = 1, v1_g, direction = c("backward", 
        "forward", "null"), standardize = TRUE, log_v0 = FALSE) 
{
    type <- match.arg(type)
    direction <- match.arg(direction)
    if (missing(beta_init)) 
        beta_init = numeric(ncol(X))
    if (missing(v1_g)) {
        v1_g = v1
    }
    if (missing(temperature)) {
        temperature = 1
    }
    else {
        temperature = 1/temperature
    }
    if (class(Y) != "numeric") {
        tmp <- try(Y <- as.numeric(Y), silent = TRUE)
        if (class(tmp)[1] == "try-error") 
            stop("Y must numeric or able to be coerced to numeric")
    }
    if (class(X) != "matrix") {
        tmp <- try(X <- model.matrix(~0 + ., data = X), silent = TRUE)
        if (class(tmp)[1] == "try-error") 
            stop("X must be a matrix or able to be coerced to a matrix")
    }
    if (any(is.na(Y)) | any(is.na(X))) 
        stop("Missing data (NA's) detected.  Take actions (e.g., removing cases, removing features, imputation) to eliminate missing data before passing Y and X to EMVS")
    if (is.unsorted(v0)) 
        stop("Ladder of v0 values must be increasing")
    if (sum(v1 < v0) > 0) 
        stop("v1 has to be larger than v0")
    if (class(beta_init) != "numeric") {
        tmp <- try(beta_init <- as.numeric(beta_init), silent = TRUE)
        if (class(tmp)[1] == "try-error") 
            stop("beta_init must numeric or able to be coerced to numeric")
    }
    if (length(beta_init) != ncol(X)) 
        stop("beta_init has to be of length ncol(X)")
    if (length(a) > 1) 
        stop("a has to be a scalar")
    if (length(b) > 1) 
        stop("b has to be a scalar")
    if (length(v1) > 1) 
        stop("v1 has to be a scalar")
    if (length(theta) > 1) 
        stop("theta has to be a scalar")
    if (length(v1_g) > 1) 
        stop("v1_g has to be a scalar")
    if (length(sigma_init) > 1) 
        stop("sigma_init has to be a scalar")
    if (length(temperature) > 1) 
        stop("temperature has to be a scalar")
    if (standardize) {
        XX <- t(X)
        center <- apply(XX, 1, mean)
        XX <- XX - center
        scale <- sqrt(apply(XX, 1, function(x) sum(x^2))/nrow(X))
        XX <- 1/scale * XX
        XX <- t(XX)
        nz <- which(scale > 1e-06)
        if (length(nz) != ncol(XX)) 
            XX <- XX[, nz, drop = FALSE]
    }
    else {
        XX <- X
    }
    p <- ncol(XX)
    YY <- Y - mean(Y)
    n <- nrow(XX)
    if (n != length(Y)) 
        stop("length of Y has to be nrow(X)")
    if (independent == T) {
        res <- .ind_EMVS(YY, XX, v0, v1, type, beta_init, sigma_init, 
            epsilon, temperature, theta, a, b, direction)
    }
    else {
        res <- .conj_EMVS(YY, XX, v0, v1, type, beta_init, sigma_init, 
            epsilon, temperature, theta, a, b, v1_g, direction)
    }
    if (standardize) {
        betas <- res$betas
        betas <- t(res$betas)
        bbb <- betas/scale[nz]
        res$betas <- t(bbb)
    }
    if (independent == T) {
        res$independent = T
    }
    else {
        res$independent = F
    }
    if (log_v0 == T) {
        res$log_v0 = T
    }
    else {
        res$log_v0 = F
    }
    return(res)
}
<bytecode: 0x561ceefc5d30>
<environment: namespace:EMVS>
 --- function search by body ---
Function EMVS in namespace EMVS has this body.
 ----------- END OF FAILURE REPORT -------------- 
Fatal error: the condition has length > 1