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

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: AG
> ### Title: Ancestral graph
> ### Aliases: AG
> ### Keywords: graphs ancestral graph directed acyclic graph marginalization
> ###   and conditioning
> 
> ### ** Examples
>                 
> ##The adjacency matrix of a DAG    
> ex<-matrix(c(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 
+              0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+              1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+              0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+              0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,
+              0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,
+              0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+              0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+              0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,
+              0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,
+              0,0,0,0,1,0,1,0,1,1,0,0,0,0,0,0,
+              1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+              0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,
+              0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+              1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,
+              0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0),16,16,byrow=TRUE)
> M <- c(3,5,6,15,16)
> C <- c(4,7)
> AG(ex, M, C, plot = TRUE)
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
ggm
 --- call from context --- 
AG(ex, M, C, plot = TRUE)
 --- call from argument --- 
if (class(amat) == "matrix") {
    if (nrow(amat) == ncol(amat)) {
        if (length(rownames(amat)) != ncol(amat)) {
            rownames(amat) <- 1:ncol(amat)
            colnames(amat) <- 1:ncol(amat)
        }
    }
    else {
        stop("'object' is not in a valid adjacency matrix form")
    }
}
 --- R stacktrace ---
where 1: AG(ex, M, C, plot = TRUE)

 --- value of length: 2 type: logical ---
[1]  TRUE FALSE
 --- function from context --- 
function (amat, M = c(), C = c(), showmat = TRUE, plot = FALSE, 
    plotfun = plotGraph, ...) 
{
    if (class(amat) == "igraph" || class(amat) == "graphNEL" || 
        class(amat) == "character") {
        amat <- grMAT(amat)
    }
    if (class(amat) == "matrix") {
        if (nrow(amat) == ncol(amat)) {
            if (length(rownames(amat)) != ncol(amat)) {
                rownames(amat) <- 1:ncol(amat)
                colnames(amat) <- 1:ncol(amat)
            }
        }
        else {
            stop("'object' is not in a valid adjacency matrix form")
        }
    }
    if (class(amat) != "matrix") {
        stop("'object' is not in a valid form")
    }
    S <- C
    St <- c()
    while (identical(S, St) == FALSE) {
        St <- S
        for (j in S) {
            for (i in rownames(amat)) {
                if (amat[i, j]%%10 == 1) {
                  S <- c(i, S[S != i])
                }
            }
        }
    }
    amatr <- amat
    amatt <- 2 * amat
    while (identical(amatr, amatt) == FALSE) {
        amatt <- amatr
        amat21 <- amatr
        for (kk in M) {
            for (kkk in 1:ncol(amatr)) {
                amat31 <- amatr
                if (amatr[kkk, kk]%%10 == 1 | amatr[kk, kkk]%%10 == 
                  1) {
                  amat31[kk, kkk] <- amatr[kkk, kk]
                  amat31[kkk, kk] <- amatr[kk, kkk]
                }
                idx <- which(amat31[, kk]%%10 == 1)
                lenidx <- length(idx)
                if ((lenidx > 1 & amat31[kkk, kk]%%10 == 1)) {
                  for (ii in 1:(lenidx)) {
                    if (amatr[idx[ii], kkk]%%10 == 0 & idx[ii] != 
                      kkk) {
                      amat21[idx[ii], kkk] <- TRUE
                    }
                  }
                }
            }
        }
        amatr <- amat21
        amat22 <- matrix(rep(0, length(amat)), dim(amat))
        for (kk in S) {
            idx <- which(amatr[, kk]%%10 == 1)
            idy <- which(amatr[, kk] > 99)
            lenidx <- length(idx)
            lenidy <- length(idy)
            if ((lenidx > 0 & lenidy > 0)) {
                for (ii in 1:(lenidx)) {
                  for (jj in 1:lenidy) {
                    if (amatr[idx[ii], idy[jj]]%%10 == 0 & idx[ii] != 
                      idy[jj]) {
                      amat22[idx[ii], idy[jj]] <- 1
                    }
                  }
                }
            }
        }
        amatr <- amat22 + amatr
        amat33 <- t(amatr)
        amat23 <- matrix(rep(0, length(amat)), dim(amat))
        for (kk in M) {
            idx <- which(amat33[, kk]%%10 == 1)
            idy <- which(amat33[, kk]%%100 > 9)
            lenidx <- length(idx)
            lenidy <- length(idy)
            if ((lenidx > 0 & lenidy > 0)) {
                for (ii in 1:(lenidx)) {
                  for (jj in 1:lenidy) {
                    if (amatr[idy[jj], idx[ii]]%%10 == 0 & idx[ii] != 
                      idy[jj]) {
                      amat23[idy[jj], idx[ii]] <- 1
                    }
                  }
                }
            }
        }
        amatr <- amat23 + amatr
        amat24 <- matrix(rep(0, length(amat)), dim(amat))
        for (kk in M) {
            idx <- which(amatr[, kk]%%100 > 9)
            idy <- which(amatr[, kk] > 99)
            lenidx <- length(idx)
            lenidy <- length(idy)
            if ((lenidx > 0 & lenidy > 0)) {
                for (ii in 1:(lenidx)) {
                  for (jj in 1:lenidy) {
                    if (amatr[idx[ii], idy[jj]]%%10 == 0 & idx[ii] != 
                      idy[jj]) {
                      amat24[idx[ii], idy[jj]] <- 1
                    }
                  }
                }
            }
        }
        amatr <- amat24 + amatr
        amat35 <- t(amatr)
        amat25 <- matrix(rep(0, length(amat)), dim(amat))
        for (kk in M) {
            idx <- which(amat35[, kk]%%10 == 1)
            lenidx <- length(idx)
            if ((lenidx > 1)) {
                for (ii in 1:(lenidx - 1)) {
                  for (jj in (ii + 1):lenidx) {
                    if (amatr[idx[ii], idx[jj]] < 100) {
                      amat25[idx[ii], idx[jj]] <- 100
                    }
                  }
                }
            }
        }
        amatr <- amat25 + t(amat25) + amatr
        amat36 <- t(amatr)
        amat26 <- matrix(rep(0, length(amat)), dim(amat))
        for (kk in M) {
            idx <- which(amat36[, kk]%%10 == 1)
            idy <- which(amat36[, kk] > 99)
            lenidx <- length(idx)
            lenidy <- length(idy)
            if ((lenidx > 0 & lenidy > 0)) {
                for (ii in 1:(lenidx)) {
                  for (jj in 1:lenidy) {
                    if (amatr[idy[jj], idx[ii]] < 100 & idx[ii] != 
                      idy[jj]) {
                      amat26[idy[jj], idx[ii]] <- 100
                    }
                  }
                }
            }
        }
        amatr <- amat26 + t(amat26) + amatr
        amat27 <- matrix(rep(0, length(amat)), dim(amat))
        for (kk in S) {
            idx <- which(amatr[, kk] > 99)
            lenidx <- length(idx)
            if ((lenidx > 1)) {
                for (ii in 1:(lenidx - 1)) {
                  for (jj in (ii + 1):lenidx) {
                    if (amatr[idx[ii], idx[jj]] < 100) {
                      amat27[idx[ii], idx[jj]] <- 100
                    }
                  }
                }
            }
        }
        amatr <- amat27 + t(amat27) + amatr
        amat28 <- matrix(rep(0, length(amat)), dim(amat))
        for (kk in S) {
            idx <- which(amatr[, kk]%%10 == 1)
            lenidx <- length(idx)
            if ((lenidx > 1)) {
                for (ii in 1:(lenidx - 1)) {
                  for (jj in (ii + 1):lenidx) {
                    if (amatr[idx[ii], idx[jj]]%%100 < 10) {
                      amat28[idx[ii], idx[jj]] <- 10
                    }
                  }
                }
            }
        }
        amatr <- amat28 + t(amat28) + amatr
        amat29 <- matrix(rep(0, length(amat)), dim(amat))
        for (kk in M) {
            idx <- which(amatr[, kk]%%10 == 1)
            idy <- which(amatr[, kk]%%100 > 9)
            lenidx <- length(idx)
            lenidy <- length(idy)
            if ((lenidx > 0 & lenidy > 0)) {
                for (ii in 1:(lenidx)) {
                  for (jj in 1:lenidy) {
                    if (amatr[idx[ii], idy[jj]]%%100 < 10 & idx[ii] != 
                      idy[jj]) {
                      amat29[idx[ii], idy[jj]] <- 10
                    }
                  }
                }
            }
        }
        amatr <- amat29 + t(amat29) + amatr
        amat20 <- matrix(rep(0, length(amat)), dim(amat))
        for (kk in M) {
            idx <- which(amatr[, kk]%%100 > 9)
            lenidx <- length(idx)
            if ((lenidx > 1)) {
                for (ii in 1:(lenidx - 1)) {
                  for (jj in (ii + 1):lenidx) {
                    if (amatr[idx[ii], idx[jj]]%%100 < 10) {
                      amat20[idx[ii], idx[jj]] <- 10
                    }
                  }
                }
            }
        }
        amatr <- amat20 + t(amat20) + amatr
    }
    for (i in 1:ncol(amatr)) {
        for (j in 1:ncol(amatr)) {
            if (amatr[i, j]%%100 > 9) {
                amatr[i, j] <- 10
                for (k in 1:ncol(amatr)) {
                  if (amatr[k, j] == 100) {
                    amatr[j, k] <- 1
                    amatr[k, j] <- 0
                  }
                }
            }
        }
    }
    SS <- S
    SSt <- c()
    while (identical(SS, SSt) == FALSE) {
        SSt <- SS
        for (j in SS) {
            for (i in rownames(amat)) {
                if (amatr[i, j]%%10 == 1) {
                  SS <- c(i, SS[SS != i])
                }
            }
        }
    }
    for (i in SS) {
        for (j in SS) {
            if (amatr[i, j]%%10 == 1) {
                amatr[i, j] <- 10
                amatr[j, i] <- 10
            }
        }
    }
    amatn <- amatr
    for (kk in 1:ncol(amatr)) {
        for (kkk in 1:ncol(amatr)) {
            amat3n <- amatr
            if (amatr[kkk, kk]%%10 == 1 | amatr[kk, kkk]%%10 == 
                1) {
                amat3n[kk, kkk] <- amatr[kkk, kk]
                amat3n[kkk, kk] <- amatr[kk, kkk]
            }
            idx <- which(amat3n[, kk]%%10 == 1)
            lenidx <- length(idx)
            if ((lenidx > 1 & amat3n[kkk, kk]%%10 == 1)) {
                for (ii in 1:(lenidx)) {
                  if (amatr[idx[ii], kkk]%%10 == 0 & idx[ii] != 
                    kkk) {
                    amatn[idx[ii], kkk] <- TRUE
                  }
                }
            }
        }
    }
    amatt <- 2 * amat
    while (identical(amatr, amatt) == FALSE) {
        amatt <- amatr
        amat27n <- matrix(rep(0, length(amat)), dim(amat))
        for (kk in 1:ncol(amatr)) {
            idx <- which(amatn[, kk] > 99)
            lenidx <- length(idx)
            if ((lenidx > 1)) {
                for (ii in 1:(lenidx - 1)) {
                  for (jj in (ii + 1):lenidx) {
                    if (amatr[idx[ii], idx[jj]] < 100 && (amatn[kk, 
                      idx[ii]]%%10 == 1 || amatn[kk, idx[jj]]%%10 == 
                      1)) {
                      amat27n[idx[ii], idx[jj]] <- 100
                    }
                  }
                }
            }
        }
        amatn <- amat27n + t(amat27n) + amatn
        amatr <- amat27n + t(amat27n) + amatr
        amat22n <- matrix(rep(0, length(amat)), dim(amat))
        for (kk in 1:ncol(amatr)) {
            idx <- which(amatn[, kk]%%10 == 1)
            idy <- which(amatn[, kk] > 99)
            lenidx <- length(idx)
            lenidy <- length(idy)
            if ((lenidx > 0 & lenidy > 0)) {
                for (ii in 1:(lenidx)) {
                  for (jj in 1:lenidy) {
                    if (amatr[idx[ii], idy[jj]]%%10 == 0 & idx[ii] != 
                      idy[jj] & amatn[kk, idy[jj]]%%10 == 1) {
                      amat22n[idx[ii], idy[jj]] <- 1
                    }
                  }
                }
            }
        }
        amatn <- amat22n + amatn
        amatr <- amat22n + amatr
    }
    for (i in 1:ncol(amatr)) {
        for (j in 1:ncol(amatr)) {
            if (amatr[i, j] == 101) {
                amatr[i, j] <- 1
                amatr[j, i] <- 0
            }
        }
    }
    Mn <- c()
    Cn <- c()
    for (i in M) {
        Mn <- c(Mn, which(rownames(amat) == i))
    }
    for (i in C) {
        Cn <- c(Cn, which(rownames(amat) == i))
    }
    if (length(Mn) > 0 & length(Cn) > 0) {
        fr <- amatr[-c(Mn, Cn), -c(Mn, Cn)]
    }
    if (length(Mn) > 0 & length(Cn) == 0) {
        fr <- amatr[-c(Mn), -c(Mn)]
    }
    if (length(Mn) == 0 & length(Cn) > 0) {
        fr <- amatr[-c(Cn), -c(Cn)]
    }
    if (length(Mn) == 0 & length(Cn) == 0) {
        fr <- amatr
    }
    if (plot == TRUE) {
        plotfun(fr, ...)
    }
    if (showmat == FALSE) {
        invisible(fr)
    }
    else {
        return(fr)
    }
}
<bytecode: 0x55e240c9aaa8>
<environment: namespace:ggm>
 --- function search by body ---
Function AG in namespace ggm has this body.
 ----------- END OF FAILURE REPORT -------------- 
Fatal error: the condition has length > 1