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

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: optPenaltyPgen.kCVauto.banded
> ### Title: Automatic search for optimal penalty parameter (generalized
> ###   ridge precision).
> ### Aliases: optPenaltyPgen.kCVauto.banded
> 
> ### ** Examples
> 
> # set dimension and sample size
> p <- 10
> n <- 10
> 
> # penalty parameter matrix
> lambda       <- matrix(1, p, p)
> diag(lambda) <- 0.1
> 
> # generate precision matrix
> Omega       <- matrix(0.4, p, p)
> diag(Omega) <- 1
> Sigma       <- solve(Omega)
> 
> # data 
> Y <- mvtnorm::rmvnorm(n, mean=rep(0,p), sigma=Sigma)
> S <- cov(Y)
> 
> # find optimal penalty parameters through cross-validation
> lambdaOpt <- optPenaltyPgen.kCVauto.banded(Y, 10^(-10), 10^(10),
+ 			  target=matrix(0, p, p),
+                           penalize.diag=FALSE, nInit=100, 
+                           minSuccDiff=10^(-5)) 
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
porridge
 --- call from context --- 
optPenaltyPgen.kCVauto.banded(Y, 10^(-10), 10^(10), target = matrix(0, 
    p, p), penalize.diag = FALSE, nInit = 100, minSuccDiff = 10^(-5))
 --- call from argument --- 
if (as.character(class(zeros)) != "matrix") {
    stop("Input (zeros) is of wrong class.")
}
 --- R stacktrace ---
where 1: optPenaltyPgen.kCVauto.banded(Y, 10^(-10), 10^(10), target = matrix(0, 
    p, p), penalize.diag = FALSE, nInit = 100, minSuccDiff = 10^(-5))

 --- value of length: 2 type: logical ---
[1] FALSE  TRUE
 --- function from context --- 
function (Y, lambdaMin, lambdaMax, lambdaInit = (lambdaMin + 
    lambdaMax)/2, fold = nrow(Y), target, zeros = matrix(nrow = 0, 
    ncol = 2), penalize.diag = TRUE, nInit = 100, minSuccDiff = 10^(-5)) 
{
    if (!is.matrix(Y)) {
        stop("Input (Y) should be a matrix")
    }
    if (class(lambdaMin) != "numeric") {
        stop("Input (lambdaMin) is of wrong class")
    }
    if (length(lambdaMin) < 1) {
        stop("Input (lambdaMin) must be a scalar")
    }
    if (any(lambdaMin <= 0)) {
        stop("Input (lambdaMin) must be positive")
    }
    if (class(lambdaMax) != "numeric") {
        stop("Input (lambdaMax) is of wrong class")
    }
    if (length(lambdaMax) < 1) {
        stop("Input (lambdaMax) must be a scalar")
    }
    if (any(lambdaMax <= lambdaMin)) {
        stop("Input (lambdaMax) must be larger than lambdaMin")
    }
    if (class(lambdaInit) != "numeric") {
        stop("Input (lambdaInit) is of wrong class")
    }
    if (length(lambdaInit) < 1) {
        stop("Input (lambdaInit) must be a scalar")
    }
    if (any(lambdaInit <= lambdaMin)) {
        stop("Input (lambdaInit) must be larger than lambdaMin")
    }
    if (any(lambdaInit > lambdaMax)) {
        stop("Input (lambdaInit) must be smaller than lambdaMax")
    }
    if (class(fold) != "numeric" & class(fold) != "integer") {
        stop("Input (fold) is of wrong class")
    }
    if ((fold <= 1) | (fold > nrow(Y))) {
        stop("Input (fold) out of range")
    }
    if (!isSymmetric(target)) {
        stop("target should be a symmetric matrix")
    }
    if (as.character(class(minSuccDiff)) != "numeric") {
        stop("Input (minSuccDiff) is of wrong class.")
    }
    if (length(minSuccDiff) != 1) {
        stop("Input (minSuccDiff) is of wrong length.")
    }
    if (is.na(minSuccDiff)) {
        stop("Input (minSuccDiff) is not a positive number.")
    }
    if (minSuccDiff <= 0) {
        stop("Input (minSuccDiff) is not a positive number.")
    }
    if (as.character(class(nInit)) != "numeric" & as.character(class(nInit)) != 
        "integer") {
        stop("Input (nInit) is of wrong class.")
    }
    if (length(nInit) != 1) {
        stop("Input (nInit) is of wrong length.")
    }
    if (is.na(nInit)) {
        stop("Input (nInit) is not a positive integer.")
    }
    if (nInit < 0) {
        stop("Input (nInit) is not a positive integer.")
    }
    if (nInit%%1 != 0) {
        stop("Input (nInit) is not a positive integer.")
    }
    if (as.character(class(zeros)) != "matrix") {
        stop("Input (zeros) is of wrong class.")
    }
    if (ncol(zeros) != 2) {
        stop("Wrong dimensions of the (zeros).")
    }
    if (as.character(class(penalize.diag)) != "logical") {
        stop("Input (penalize.diag) is of wrong class.")
    }
    fold <- max(min(ceiling(fold), nrow(Y)), 2)
    fold <- rep(1:fold, ceiling(nrow(Y)/fold))[1:nrow(Y)]
    shuffle <- sample(1:nrow(Y), nrow(Y))
    folds <- split(shuffle, as.factor(fold))
    names(folds) <- NULL
    optLambda <- optim(lambdaInit, .armaKCVlossR_banded, gr = NULL, 
        method = "Brent", Y = Y, lower = lambdaMin, upper = lambdaMax, 
        folds = folds, target = target, penalize_diag = penalize.diag, 
        zerosR = zeros[, 1] - 1, zerosC = zeros[, 2] - 1, nInit = nInit, 
        minSuccDiff = minSuccDiff)$par
    return(optLambda)
}
<bytecode: 0x55c21fd469d8>
<environment: namespace:porridge>
 --- function search by body ---
Function optPenaltyPgen.kCVauto.banded in namespace porridge has this body.
 ----------- END OF FAILURE REPORT -------------- 
Fatal error: the condition has length > 1