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

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: findMRCIs
> ### Title: Find MRCIs
> ### Aliases: findMRCIs
> 
> ### ** Examples
> 
> 
> ## a simple who infected whom matrix:
> tree1 <- cbind(Infector=1:5,Infectee=2:6) 
> findMRCIs(tree1)
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
treespace
 --- call from context --- 
findMRCIs(tree1)
 --- call from argument --- 
if (class(wiw) != "matrix") stop("The who infected whom information supplied should be of class matrix.")
 --- R stacktrace ---
where 1: findMRCIs(tree1)

 --- value of length: 2 type: logical ---
[1] FALSE  TRUE
 --- function from context --- 
function (wiw) 
{
    if (class(wiw) != "matrix") 
        stop("The who infected whom information supplied should be of class matrix.")
    wiwCopy <- matrix(0, nrow(wiw), 2)
    wiwNames <- unique(c(wiw[, 1], wiw[, 2]))
    wiwCopy[, 1] <- match(wiw[, 1], wiwNames)
    wiwCopy[, 2] <- match(wiw[, 2], wiwNames)
    wiw <- wiwCopy
    initial <- min(wiw)
    if (initial == 0) {
        wiw <- wiw + 1
        initial <- min(wiw)
    }
    l <- max(wiw)
    DirectDesc <- lapply(initial:l, function(x) {
        wiw[which(wiw[, 1] == x), 2]
    })
    numDDs <- sapply(DirectDesc, length)
    AllDesc <- lapply(initial:l, function(x) {
        DDs <- DirectDesc[[x]]
        tmpNumDDs <- length(DDs)
        allDs <- rep(NA, length(initial:l))
        allDs[[1]] <- x
        while (tmpNumDDs != 0) {
            allDs[which(is.na(allDs))[1:tmpNumDDs]] <- DDs
            DDs <- do.call(c, DirectDesc[DDs])
            tmpNumDDs <- length(DDs)
        }
        return(allDs[!is.na(allDs)])
    })
    M <- matrix(0, nrow = l, ncol = l)
    for (tmp in initial:l) {
        for (i in AllDesc[[tmp]]) {
            M[tmp, i] <- M[i, tmp] <- tmp
        }
        tmpDDs <- DirectDesc[[tmp]]
        numTmpDDs <- length(tmpDDs)
        if (numTmpDDs > 1) {
            pairs <- combn2(tmpDDs)
            for (j in 1:length(pairs[, 1])) {
                M[AllDesc[[pairs[j, 1]]], AllDesc[[pairs[j, 2]]]] <- M[AllDesc[[pairs[j, 
                  2]]], AllDesc[[pairs[j, 1]]]] <- tmp
            }
        }
    }
    diag(M) <- initial:l
    if (min(M) == 0) {
        warning("No single source case; returning source of longest transmission chain")
        transChainLengths <- sapply(AllDesc, function(x) length(x))
        sourceOfLongestChain <- which(transChainLengths == max(transChainLengths))
        sourceCase <- sourceOfLongestChain
    }
    else {
        sourceCase <- NA
        count <- 1
        while (is.na(sourceCase)) {
            isSource <- setequal(AllDesc[[count]], initial:l)
            if (isSource) {
                sourceCase <- count
            }
            count <- count + 1
        }
    }
    depths <- rep(NA, l)
    count <- 0
    depths[[sourceCase]] <- count
    SCdescs <- unlist(DirectDesc[[sourceCase]], FALSE, FALSE)
    while (length(SCdescs) != 0) {
        count <- count + 1
        depths[SCdescs] <- count
        SCdescs <- unlist(DirectDesc[SCdescs], FALSE, FALSE)
    }
    D <- matrix(ncol = l, nrow = l, depths[M])
    M <- matrix(ncol = l, nrow = l, wiwNames[M])
    colnames(M) <- rownames(M) <- colnames(D) <- rownames(D) <- wiwNames
    return(list(sourceCase = wiwNames[[sourceCase]], mrcis = M, 
        mrciDepths = D))
}
<bytecode: 0x55f211da30a0>
<environment: namespace:treespace>
 --- function search by body ---
Function findMRCIs in namespace treespace has this body.
 ----------- END OF FAILURE REPORT -------------- 
Fatal error: the condition has length > 1