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

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: pcaLR
> ### Title: generates a closure for the computation of the likelihood ratio
> ###   statistic for the kernel PCA prototype.
> ### Aliases: pcaLR
> 
> ### ** Examples
> 
> n <- 30
> p <- 20
> K <- replicate(5, matrix(rnorm(n*p), nrow = n, ncol = p), simplify = FALSE)
> K <-  sapply(K, function(X) return(X %*% t(X) / dim(X)[2]), simplify = FALSE)
> print(typeof(pcaLR(K, mu = 0, sigma = 1)) == "closure")
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
kernelPSI
 --- call from context --- 
pcaLR(K, mu = 0, sigma = 1)
 --- call from argument --- 
if (class(Ksum) != "kernelMatrix") {
    Ksum <- kernlab::as.kernelMatrix(Ksum, center = FALSE)
}
 --- R stacktrace ---
where 1: pcaLR(K, mu = 0, sigma = 1)
where 2: typeof(pcaLR(K, mu = 0, sigma = 1))
where 3: print(typeof(pcaLR(K, mu = 0, sigma = 1)) == "closure")

 --- value of length: 2 type: logical ---
[1] TRUE TRUE
 --- function from context --- 
function (K, mu = 0, sigma = 1) 
{
    if (is.list(K)) {
        Ksum <- Reduce(`+`, K)
    }
    else {
        Ksum <- K
    }
    if (class(Ksum) != "kernelMatrix") {
        Ksum <- kernlab::as.kernelMatrix(Ksum, center = FALSE)
    }
    Krot <- kernlab::kpca(Ksum)@rotated
    H <- Krot %*% pracma::pinv(Krot)
    M <- sum(eigen(H, symmetric = TRUE, only.values = TRUE)[["values"]] > 
        0.5)
    statistic <- function(Z) {
        roots <- Re(polyroot(c(-M + drop(t(Z - mu) %*% H %*% 
            Z)/sigma^2, -drop(t(2 * Z - mu) %*% H %*% Z)/sigma^2, 
            drop(t(Z) %*% H %*% Z)/sigma^2)))
        roots <- roots[roots < 1, drop = FALSE]
        R <- max(sapply(roots, function(r) 2 * M * log(1 - r) + 
            2 * r * drop(t(Z - mu) %*% H %*% Z)/sigma^2 - r^2 * 
            drop(t(Z) %*% H %*% Z)/sigma^2))
        return(R)
    }
}
<bytecode: 0x557dcbbdc7a8>
<environment: namespace:kernelPSI>
 --- function search by body ---
Function pcaLR in namespace kernelPSI has this body.
 ----------- END OF FAILURE REPORT -------------- 
Fatal error: the condition has length > 1