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

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: pawls
> ### Title: Penalized adaptive weighted least squares regression
> ### Aliases: pawls
> 
> ### ** Examples
> 
> ## generate data
> library("mvtnorm")
> set.seed(123)  # for reproducibility
> n = 100 # number of observations
> p = 8 # number of variables
> beta = c(1, 2, 3, 0, 0, 0, 0, 0) # coefficients
> sigma <- 0.5      # controls signal-to-noise ratio
> epsilon <- 0.1    # contamination level
> Sigma <- 0.5^t(sapply(1:p, function(i, j) abs(i-j), 1:p))
> x <- rmvnorm(n, sigma=Sigma)    # predictor matrix
> e <- rnorm(n)                   # error terms
> i <- 1:ceiling(epsilon*n)       # observations to be contaminated
> e[i] <- e[i] + 5                # vertical outliers
> y <- c(x %*% beta + sigma * e)  # response
> x[i,] <- x[i,] + 5              # bad leverage points
> 
> ## fit pawls model over a find grid of tuning parameters
> pawls(x,y)
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
pawls
 --- call from context --- 
pawls(x, y)
 --- call from argument --- 
if (class(x) != "matrix") {
    tmp <- try(x <- as.matrix(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: pawls(x, y)

 --- value of length: 2 type: logical ---
[1] FALSE  TRUE
 --- function from context --- 
function (x, y, nlambda1 = 100, nlambda2 = 50, lambda1 = NULL, 
    lambda2 = NULL, lambda1.min = 0.05, lambda2.min = 0.001, 
    beta0 = NULL, w0 = NULL, initial = c("uniform", "PAWLS"), 
    delta = 1e-06, maxIter = 1000, intercept = TRUE, standardize = TRUE, 
    search = c("grid", "cross")) 
{
    n = length(y)
    p = dim(x)[2]
    if (class(x) != "matrix") {
        tmp <- try(x <- as.matrix(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")
    }
    if (any(is.na(y)) | any(is.na(x))) 
        stop("Missing data (NA's) detected.Take actions to eliminate missing data before passing \n         X and y to pawls.")
    initial <- match.arg(initial)
    search <- match.arg(search)
    penalty2 <- "L1"
    penalty1 <- "L1"
    criterion <- "BIC"
    startBeta <- NULL
    startW <- NULL
    if (!is.null(lambda1)) 
        nlambda1 <- length(lambda1)
    if (!is.null(lambda2)) 
        nlambda2 <- length(lambda2)
    if (initial == "PAWLS") {
        init = pawls(x, y, lambda1.min = 0.05, lambda2.min = 0.001, 
            intercept = intercept, search = "grid")
        beta0 = SetBeta0(init$beta)
        w0 = ifelse(init$w == 1, 0.99, init$w)
    }
    else if (initial == "uniform") {
        if (is.null(beta0)) {
            beta0 = rep(1, p)
            if (intercept) 
                beta0 = c(1, beta0)
        }
        if (is.null(w0)) 
            w0 = rep(0.99, n)
        beta0 = SetBeta0(beta0)
        w0 = ifelse(w0 == 1, 0.99, w0)
    }
    if (intercept) {
        x = AddIntercept(x)
    }
    std = 0
    scale = 0
    if (standardize) {
        std <- .Call("Standardize", x, y)
        XX <- std[[1]]
        yy <- std[[2]]
        scale <- std[[3]]
    }
    else {
        XX = x
        yy = y
    }
    if (is.null(lambda1) || is.null(lambda2)) {
        lambda = setup_parameter(x = XX, y = yy, nlambda1 = nlambda1, 
            nlambda2 = nlambda2, lambda1.min = lambda1.min, lambda2.min = lambda2.min, 
            beta0 = beta0, w0 = w0)
        if (is.null(lambda1)) 
            lambda1 = lambda$lambda1
        if (is.null(lambda2)) 
            lambda2 = lambda$lambda2
    }
    if (search == "grid") {
        res1 <- pawls_grid(x = XX, y = yy, penalty1 = penalty1, 
            penalty2 = penalty2, lambda1 = lambda1, lambda2 = lambda2, 
            beta0 = beta0, w0 = w0, delta = delta, maxIter = maxIter, 
            intercept = intercept)
        res2 <- BIC_grid(res1$wloss, res1$beta, res1$w)
        fit <- list(beta = res2$beta, w = res2$w, lambda1 = lambda1, 
            lambda2 = lambda2, opt.lambda1 = lambda1[res2$index1], 
            opt.lambda2 = lambda2[res2$index2], iter = res1$iter, 
            ws = res1$w, betas = res1$betas, raw.bic = res2$raw.bic, 
            bic = res2$bic)
        class(fit) <- "pawls.grid"
    }
    else {
        res = pawls_cross(x = XX, y = yy, penalty1 = penalty1, 
            penalty2 = penalty2, lambda1 = lambda1, lambda2 = lambda2, 
            beta0 = beta0, w0 = w0, delta = delta, maxIter = maxIter, 
            intercept = intercept, criterion = criterion, startBeta = startBeta, 
            startW = startW)
        fit <- list(beta = res$beta, w = res$w, lambda1 = lambda1, 
            lambda2 = lambda2, opt.lambda1 = res$opt.lambda1, 
            opt.lambda2 = res$opt.lambda2, iter = res$iter)
        class(fit) <- "pawls.cross"
    }
    if (standardize) {
        scale = ifelse(scale == 0, 0, 1/scale)
        fit$beta = fit$beta * scale
    }
    fit
}
<bytecode: 0x152ec88>
<environment: namespace:pawls>
 --- function search by body ---
Function pawls in namespace pawls has this body.
 ----------- END OF FAILURE REPORT -------------- 
Fatal error: the condition has length > 1