Running examples in 'l0ara-Ex.R' failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: cv.l0ara
> ### Title: cross-validation for l0ara
> ### Aliases: cv.l0ara
> 
> ### ** Examples
> 
> #' # Linear regression
> # Generate design matrix and response variable
> n <- 100
> p <- 40
> x <- matrix(rnorm(n*p), n, p)
> beta <- c(1,0,2,3,rep(0,p-4))
> noise <- rnorm(n)
> y <- x%*%beta+noise
> lam <- c(0.1, 0.3, 0.5)
> fit <- cv.l0ara(x, y, family="gaussian", lam, measure = "mse")
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
l0ara
 --- call from context --- 
cv.l0ara(x, y, family = "gaussian", lam, measure = "mse")
 --- 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: cv.l0ara(x, y, family = "gaussian", lam, measure = "mse")

 --- value of length: 2 type: logical ---
[1] FALSE  TRUE
 --- function from context --- 
function (x, y, family = c("gaussian", "logit", "gamma", "poisson", 
    "inv.gaussian"), lam, measure = c("mse", "mae", "class", 
    "auc"), nfolds = 10, maxit = 10^3, eps = 1e-04, seed) 
{
    measure <- match.arg(measure)
    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 (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")
    }
    y <- drop(y)
    if (!is.null(lam) && length(lam) < 2) {
        stop("Need a sequence values for lambda")
    }
    if (nfolds < 3) {
        stop("nfolds must be bigger than 3")
    }
    if (!missing(seed)) {
        set.seed(seed)
    }
    n <- nrow(x)
    p <- ncol(x)
    res <- as.list(1:nfolds)
    error <- matrix(NA, length(lam), nfolds)
    id <- sample(rep(1:nfolds, length = n))
    for (i in 1:nfolds) {
        which <- id == i
        yy <- y[!which]
        xx <- x[!which, , drop = FALSE]
        res[[i]] <- lapply(lam, function(ll) l0ara(xx, yy, lam = ll, 
            family = family, maxit = maxit, eps = eps))
        if (measure == "mse") {
            pred <- lapply(res[[i]], predict, x[which, ], type = "response")
            error[, i] <- do.call(cbind, lapply(pred, function(pp) mean((pp - 
                y[which])^2)))
        }
        if (measure == "mae") {
            pred <- lapply(res[[i]], predict, x[which, ], type = "response")
            error[, i] <- do.call(cbind, lapply(pred, function(pp) mean(abs(pp - 
                y[which]))))
        }
        if (measure == "class") {
            if (family == "logit") {
                pred <- lapply(res[[i]], predict, x[which, ], 
                  type = "class")
                error[, i] <- do.call(cbind, lapply(pred, function(pp) mean((y[which] - 
                  pp) != 0)))
            }
            else {
                stop("type='class' can only be used with family='logit'")
            }
        }
        if (measure == "auc") {
            if (family == "logit") {
                pred <- lapply(res[[i]], predict, x[which, ], 
                  type = "class")
                error[, i] <- do.call(cbind, lapply(pred, function(pp) {
                  fp <- mean(pp[y[which] == 0] == 1)
                  tp <- mean(pp[y[which] == 1] == 1)
                  return((tp - fp + 1)/2)
                }))
            }
            else {
                stop("type='auc' can only be used with family='logit'")
            }
        }
    }
    cv.std <- apply(error, 1, sd)/sqrt(n)
    cv.error <- rowMeans(error)
    lam.min <- ifelse(measure == "auc", lam[which.max(cv.error)], 
        lam[which.min(cv.error)])
    name <- switch(measure, mse = "Mean square error", mae = "Mean absolute error", 
        class = "Misclassification rate", auc = "Area under the curve")
    out <- list(cv.error = cv.error, cv.std = cv.std, lam.min = lam.min, 
        measure = measure, lambda = lam, family = family, x = x, 
        y = y, name = name)
    class(out) <- "cv.l0ara"
    return(out)
}
<bytecode: 0x4103210>
<environment: namespace:l0ara>
 --- function search by body ---
Function cv.l0ara in namespace l0ara has this body.
 ----------- END OF FAILURE REPORT -------------- 
Fatal error: the condition has length > 1