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

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: buildEnsembleStack
> ### Title: Ensemble: Stacking
> ### Aliases: buildEnsembleStack
> 
> ### ** Examples
> 
> ## Create a test function: branin
> braninFunction <- function (x) {	
+ 	(x[2]  - 5.1/(4 * pi^2) * (x[1] ^2) + 5/pi * x[1]  - 6)^2 + 
+ 10 * (1 - 1/(8 * pi)) * cos(x[1] ) + 10
+ }
> ## Create design points
> x <- cbind(runif(20)*15-5,runif(20)*15)
> ## Compute observations at design points
> y <- as.matrix(apply(x,1,braninFunction))
> ## Create model with default settings
> fit <- buildEnsembleStack(x,y)
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
SPOT
 --- call from context --- 
krigingLikelihood(x, fX, fy, optimizeP, useLambda)
 --- call from argument --- 
if (class(cholPsi) == "try-error") {
    penalty <- 10000 - min(eigen(Psi, symmetric = TRUE, only.values = TRUE)$values)
    return(list(NegLnLike = penalty, Psi = NA, Psinv = NA, mu = NA, 
        SSQ = NA))
}
 --- R stacktrace ---
where 1: krigingLikelihood(x, fX, fy, optimizeP, useLambda)
where 2: FUN(newX[, i], ...)
where 3: apply(x, 1, fitFun, fX, fy, optimizeP, useLambda)
where 4: fun(matrix(x, 1), ...)
where 5: fn(par, ...)
where 6: (function (par) 
fn(par, ...))(c(0.09, 0.09, 0))
where 7: optim(par = x, fn = fn, lower = lower, upper = upper, control = control, 
    method = "L-BFGS-B", ...)
where 8: fit$algTheta(x = x0, fun = function(x, fX, fy, optimizeP, useLambda) {
    if (!is.matrix(x)) {
        fitFun(x, fX, fy, optimizeP, useLambda)
    }
    else {
        apply(x, 1, fitFun, fX, fy, optimizeP, useLambda)
    }
}, lower = LowerTheta, upper = UpperTheta, control = opts, fX = A, 
    fy = fit$y, optimizeP = fit$optimizeP, useLambda = fit$useLambda)
where 9: control$modelL0[[j]](xt, as.matrix(yt), control$modelL0Control[[j]])
where 10: buildEnsembleStack(x, y)

 --- value of length: 2 type: logical ---
[1] FALSE FALSE
 --- function from context --- 
function (x, AX, Ay, optimizeP = FALSE, useLambda = TRUE) 
{
    nx <- nrow(AX)
    theta <- 10^x[1:nx]
    if (optimizeP) {
        AX <- abs(AX)^(x[(nx + 1):(2 * nx)])
    }
    lambda <- 0
    if (useLambda) 
        lambda <- 10^x[length(x)]
    if (any(theta == 0) || any(is.infinite(c(theta, lambda)))) {
        return(list(NegLnLike = 10000, Psi = NA, Psinv = NA, 
            mu = NA, ssq = NA))
    }
    n <- dim(Ay)[1]
    Psi <- exp(-matrix(colSums(theta * AX), n, n))
    if (useLambda) 
        Psi <- Psi + diag(lambda, n)
    if (any(is.infinite(Psi))) {
        penalty <- 10000
        return(list(NegLnLike = penalty, Psi = NA, Psinv = NA, 
            mu = NA, SSQ = NA))
    }
    kap <- rcond(Psi)
    if (is.na(kap)) 
        kap <- 0
    if (kap < 1e-10) {
        return(list(NegLnLike = 10000, Psi = NA, Psinv = NA, 
            mu = NA, SSQ = NA, a = NA, U = NA, isIndefinite = TRUE))
    }
    cholPsi <- try(chol(Psi), TRUE)
    if (class(cholPsi) == "try-error") {
        penalty <- 10000 - min(eigen(Psi, symmetric = TRUE, only.values = TRUE)$values)
        return(list(NegLnLike = penalty, Psi = NA, Psinv = NA, 
            mu = NA, SSQ = NA))
    }
    LnDetPsi <- 2 * sum(log(abs(diag(cholPsi))))
    Psinv <- try(chol2inv(cholPsi), TRUE)
    if (class(Psinv) == "try-error") {
        penalty <- 10000 - min(eigen(Psi, symmetric = TRUE, only.values = TRUE)$values)
        return(list(NegLnLike = penalty, Psi = NA, Psinv = NA, 
            mu = NA, SSQ = NA))
    }
    psisum <- sum(Psinv)
    if (psisum == 0) {
        psisum <- as.numeric(rep(1, n) %*% Psinv %*% rep(1, n))
        if (psisum == 0) {
            return(list(NegLnLike = 10000, Psi = NA, Psinv = NA, 
                mu = NA, SSQ = NA))
        }
    }
    mu <- sum(Psinv %*% Ay)/psisum
    if (is.infinite(mu) | is.na(mu)) {
        return(list(NegLnLike = 10000, Psi = NA, Psinv = NA, 
            mu = NA, SSQ = NA))
    }
    yonemu <- Ay - mu
    SigmaSqr <- (t(yonemu) %*% Psinv %*% yonemu)/n
    if (SigmaSqr < 0) {
        return(list(NegLnLike = 10000 - SigmaSqr, Psi = NA, Psinv = NA, 
            mu = NA, SSQ = NA))
    }
    NegLnLike <- n * log(SigmaSqr) + LnDetPsi
    if (is.na(NegLnLike) | is.infinite(NegLnLike)) 
        return(list(NegLnLike = 10000, Psi = NA, Psinv = NA, 
            mu = NA, SSQ = NA))
    list(NegLnLike = NegLnLike, Psi = Psi, Psinv = Psinv, mu = mu, 
        yonemu = yonemu, ssq = SigmaSqr)
}
<bytecode: 0x55838f1e28f8>
<environment: namespace:SPOT>
 --- function search by body ---
Function krigingLikelihood in namespace SPOT has this body.
 ----------- END OF FAILURE REPORT -------------- 
Fatal error: the condition has length > 1