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

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: stepBF
> ### Title: Identify the optimal number of shifts using Bayes factors
> ### Aliases: stepBF
> 
> ### ** Examples
> 
> data(mcmc.whales)
> # remove 10% burnin
> mcmc.whales <- mcmc.whales[floor(0.1 * nrow(mcmc.whales)):nrow(mcmc.whales), ]
> # from a square matrix of Bayes factor values (inputType = 'matrix')
> bfmat <- computeBayesFactors(mcmc.whales, expectedNumberOfShifts = 1, burnin = 0)
> stepBF(bfmat, step.size = 1, inputType = 'matrix')
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
BAMMtools
 --- call from context --- 
stepBF(bfmat, step.size = 1, inputType = "matrix")
 --- call from argument --- 
if (class(BFmat) == "table") {
    BFmat <- setNames(as.vector(BFmat), names(BFmat))
}
 --- R stacktrace ---
where 1: stepBF(bfmat, step.size = 1, inputType = "matrix")

 --- value of length: 2 type: logical ---
[1] FALSE FALSE
 --- function from context --- 
function (BFmat, step.size = 20, expectedNumberOfShifts = 1, 
    inputType = "matrix") 
{
    inputType <- match.arg(inputType, c("matrix", "postProb"))
    if (class(BFmat) == "table") {
        BFmat <- setNames(as.vector(BFmat), names(BFmat))
    }
    if (inputType == "postProb") {
        if (class(BFmat) == "matrix") {
            stop("If inputType is 'postProb', please provide a vector of posterior probabilities.")
        }
        post <- BFmat
        prior <- dgeom(as.numeric(names(post)), prob = 1/(1 + 
            expectedNumberOfShifts))
        BFmat <- matrix(0, nrow = length(post), ncol = length(post))
        rownames(BFmat) <- names(post)
        colnames(BFmat) <- names(post)
        for (i in 1:length(post)) {
            for (j in 1:length(post)) {
                if (post[j] == 0) {
                  BFmat[i, j] <- NA
                }
                else {
                  prior_odds <- prior[i]/prior[j]
                  post_odds <- post[i]/post[j]
                  BFmat[i, j] <- post_odds * (1/prior_odds)
                }
            }
        }
    }
    if (class(BFmat) == "numeric" | !identical(ncol(BFmat), nrow(BFmat))) {
        stop("Bayes factor matrix, BFmat, must be square, with each cell (i,j) representing the BF of model i relative to model j.")
    }
    if (step.size < 1) {
        stop("Step size is less than 1! This means you will move to more complex models even when they aren't supported by any evidence!")
    }
    if (ncol(BFmat) == 1) {
        bestModel <- as.numeric(colnames(BFmat)[1])
        secondModel <- NA
        BF <- NA
    }
    else if (ncol(BFmat) > 1) {
        Stop <- ncol(BFmat) - 1
        Out <- vector("numeric", length = Stop)
        for (i in 1:Stop) {
            Out[i] <- ifelse(BFmat[i + 1, i] > step.size, BFmat[i + 
                1, i], 0)
        }
        best <- which(Out == 0)[1]
        second <- best - 1
        bestModel <- as.integer(colnames(BFmat)[best])
        secondModel <- as.integer(colnames(BFmat)[second])
        BF <- as.numeric(BFmat[best, second])
    }
    return(list(bestModel = bestModel, secondModel = secondModel, 
        BF = BF))
}
<bytecode: 0x55e2823eadc8>
<environment: namespace:BAMMtools>
 --- function search by body ---
Function stepBF in namespace BAMMtools has this body.
 ----------- END OF FAILURE REPORT -------------- 
Fatal error: the condition has length > 1