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

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: awl1pca
> ### Title: awPCA
> ### Aliases: awl1pca
> 
> ### ** Examples
> 
> ##for 100x10 data matrix X, 
> ## lying (mostly) in the subspace defined by the first 2 unit vectors, 
> ## projects data into 1 dimension.
> X <- matrix(c(runif(100*2, -10, 10), rep(0,100*8)),nrow=100) +
+                matrix(c(rep(0,100*2),rnorm(100*8,0,0.1)),ncol=10)
> myawl1pca <- awl1pca(X)
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
pcaL1
 --- call from context --- 
awl1pca(X)
 --- call from argument --- 
if (class(X) == "data.frame") {
    X <- as.matrix(X)
}
 --- R stacktrace ---
where 1: awl1pca(X)

 --- value of length: 2 type: logical ---
[1] FALSE FALSE
 --- function from context --- 
function (X, projDim = 1, center = TRUE, projections = "l2", 
    tolerance = 0.001, iterations = 200, beta = 0.99, gamma = 0.1) 
{
    if (class(X) == "data.frame") {
        X <- as.matrix(X)
    }
    if (center) {
        X <- apply(X, 2, function(y) y - mean(y))
    }
    time.begin <- proc.time()
    n <- dim(X)[1]
    m <- dim(X)[2]
    weights.prev <- matrix(2, n, 1)
    weights <- matrix(1, n, 1)
    obj.best <- .Machine$double.xmax
    my.epsilon <- tolerance
    my.epsilon.b <- 0.1
    U.weights <- matrix(1, n, 1)
    num.iteration <- 1
    continue.algorithm <- 1
    my.beta <- beta^num.iteration
    while (continue.algorithm) {
        weights.prev <- weights
        if (num.iteration > 1) {
            my.EV.prev <- my.EV
            my.PC.prev <- as.matrix(my.PC)
        }
        if ((num.iteration > 1) && (sum(abs(weight.diff)) < gamma * 
            sum(abs(weights)))) {
            X.diff <- diag(as.vector(weight.diff)) %*% X
            X.diff2 <- t(X.diff) %*% X.diff
            my.result <- L2PCA_approx(my.EV.prev, my.PC.prev, 
                projDim, X.diff2)
            my.EV <- my.result$eigenvalues
            my.PC <- my.result$eigenvectors
        }
        else {
            X.weighted <- diag(as.vector(weights)) %*% X
            my.result <- prcomp(X.weighted)
            my.EV <- my.result$sdev[1:projDim]^2
            my.PC <- as.matrix(my.result$rotation[, 1:projDim])
        }
        Reconstuction.Errors <- X - X %*% my.PC %*% t(my.PC)
        obj.current <- sum(abs(Reconstuction.Errors))
        if (obj.current < obj.best) {
            obj.best <- obj.current
            PC.best <- my.PC
        }
        max.U <- 0
        for (i in 1:n) {
            L2.norm.obs.i <- sum(Reconstuction.Errors[i, ]^2)
            L1.norm.obs.i <- sum(abs(Reconstuction.Errors[i, 
                ]))
            if (L2.norm.obs.i > my.epsilon.b) {
                U.weights[i, 1] <- L1.norm.obs.i/L2.norm.obs.i
                max.U <- max(max.U, U.weights[i, 1])
            }
            else {
                U.weights[i, 1] <- -1
            }
        }
        U.weights[U.weights[, 1] == (-1), 1] <- max.U
        weights[U.weights[, 1] < weights[, 1] * (1 - my.beta), 
            1] <- weights[U.weights[, 1] < weights[, 1] * (1 - 
            my.beta), 1] * (1 - my.beta)
        weights[U.weights[, 1] > weights[, 1] * (1 + my.beta), 
            1] <- weights[U.weights[, 1] > weights[, 1] * (1 + 
            my.beta), 1] * (1 + my.beta)
        weights[(weights[, 1] * (1 - my.beta) <= U.weights[, 
            1]) & (U.weights[, 1] <= weights[, 1] * (1 + my.beta)), 
            1] <- U.weights[(weights[, 1] * (1 - my.beta) <= 
            U.weights[, 1]) & (U.weights[, 1] <= weights[, 1] * 
            (1 + my.beta)), 1]
        my.beta <- beta^num.iteration
        weight.diff <- weights.prev - weights
        if ((num.iteration >= iterations) || (sum(abs(weight.diff)) < 
            my.epsilon)) {
            continue.algorithm <- 0
        }
        num.iteration <- num.iteration + 1
        if (num.iteration > 2) {
            if (norm(as.matrix(my.PC) - as.matrix(my.PC.prev), 
                "F") < my.epsilon) {
                continue.algorithm <- 0
            }
        }
        cat(".", file = stderr())
    }
    cat("\n", file = stderr())
    time.exe <- as.numeric((proc.time() - time.begin)[3])
    Reconstuction.Errors <- X - X %*% PC.best %*% t(PC.best)
    Reconstructions <- X %*% PC.best %*% t(PC.best)
    Projected.Points = X %*% PC.best
    if (projections == "l1") {
        myl1projection <- l1projection(X, as.matrix(PC.best))
        Reconstructions <- myl1projection$projPoints
        Projected.Points <- myl1projection$scores
    }
    solution <- list(loadings = PC.best, scores = Projected.Points, 
        projPoints = Reconstructions, L1error = obj.best, nIter = num.iteration, 
        ElapsedTime = time.exe)
    class(solution) <- "awl1pca"
    cat("# Result summary \n", file = stderr())
    cat("L1 error = ", obj.best, "\n", file = stderr())
    cat("Num iterations = ", num.iteration, "\n", file = stderr())
    cat("Elapsed time = ", time.exe, "seconds \n\n", file = stderr())
    solution
}
<bytecode: 0x55a559ada868>
<environment: namespace:pcaL1>
 --- function search by body ---
Function awl1pca in namespace pcaL1 has this body.
 ----------- END OF FAILURE REPORT -------------- 
Fatal error: the condition has length > 1