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

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: lsem
> ### Title: Low rank spatial error model (LSEM) estimation
> ### Aliases: lsem
> 
> ### ** Examples
> 
> require(spdep)
Loading required package: spdep
Loading required package: sp
Loading required package: spData
To access larger datasets in this package, install the spDataLarge
package with: `install.packages('spDataLarge',
repos='https://nowosad.github.io/drat/', type='source')`
Loading required package: sf
Linking to GEOS 3.8.0, GDAL 2.4.3, PROJ 6.2.1
> data(boston)
> y	<- boston.c[, "CMEDV" ]
> x	<- boston.c[,c("CRIM","ZN","INDUS", "CHAS", "NOX","RM", "AGE",
+                        "DIS" ,"RAD", "TAX", "PTRATIO", "B", "LSTAT")]
> coords  <- boston.c[,c("LAT","LON")]
> weig 	<- weigen( coords )
--------------knn-based W-------------
 130/506 eigen-pairs are extracted
> res	<- lsem(y=y,x=x,weig=weig)
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
spmoran
 --- call from context --- 
fn(par, ...)
 --- call from argument --- 
if (class(test) == "try-error") {
    loglik <- Inf
} else {
    b <- Minv %*% m
    sse <- yy - 2 * t(b) %*% m + t(b) %*% M0 %*% b
    dd <- sse + sum(b[-(1:nx)]^2)
    if (emet == "reml") {
        term1 <- determinant(M)$modulus
        term2 <- (n - nx) * (1 + log(2 * pi * dd/(n - nx)))
    }
    else if (emet == "ml") {
        term1 <- determinant(as.matrix(M[-(1:nx), -(1:nx)]))$modulus
        term2 <- n * (1 + log(2 * pi * dd/n))
    }
    loglik <- term1 + term2
}
 --- R stacktrace ---
where 1: fn(par, ...)
where 2: (function (par) 
fn(par, ...))(c(0, 1))
where 3: optim(fn = lik_llslm, c(0, 1), ev = ev, evMax = evMax, yy = yy, 
    XX = XX, Xy = Xy, E = E, x = x, Xc = Xc, Ec = Ec, cy = cy, 
    EX = EX, Ey = Ey, EE = EE, n = n, nx = nx, ne = ne, emet = method, 
    method = "L-BFGS-B", lower = c(0, 0.001), upper = c(0.995, 
        5))
where 4: lsem(y = y, x = x, weig = weig)

 --- value of length: 2 type: logical ---
[1] FALSE FALSE
 --- function from context --- 
function (par, ev, evMax, yy, x, E, Xc, Ec, cy, XX, Xy, EX, Ey, 
    EE, n, nx, ne, emet) 
{
    ev_inv <- 1/(evMax - par[1] * ev)
    V_E_diag <- ev_inv * par[2]
    M00 <- n
    M01 <- Xc
    M02 <- t(t(Ec) * V_E_diag)
    M11 <- XX
    M12 <- t(EX * V_E_diag)
    M22_0 <- t(t(EE) * V_E_diag)
    M22 <- t(M22_0) * V_E_diag
    M0 <- M <- as.matrix(rbind(cbind(M00, t(M01), t(M02)), cbind(M01, 
        M11, M12), cbind(M02, t(M12), M22)))
    diag(M)[-(1:nx)] <- diag(M)[-(1:nx)] + 1
    test <- try(Minv <- solve(M, tol = 1e-30))
    m0 <- cy
    m1 <- Xy
    m2 <- t(t(Ey) * V_E_diag)
    m <- c(m0, m1, m2)
    if (class(test) == "try-error") {
        loglik <- Inf
    }
    else {
        b <- Minv %*% m
        sse <- yy - 2 * t(b) %*% m + t(b) %*% M0 %*% b
        dd <- sse + sum(b[-(1:nx)]^2)
        if (emet == "reml") {
            term1 <- determinant(M)$modulus
            term2 <- (n - nx) * (1 + log(2 * pi * dd/(n - nx)))
        }
        else if (emet == "ml") {
            term1 <- determinant(as.matrix(M[-(1:nx), -(1:nx)]))$modulus
            term2 <- n * (1 + log(2 * pi * dd/n))
        }
        loglik <- term1 + term2
    }
    return(loglik)
}
<bytecode: 0x557335d3ec10>
<environment: 0x557335d30d98>
 --- function search by body ---
 ----------- END OF FAILURE REPORT -------------- 
Fatal error: the condition has length > 1