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

> ### Name: PMplot
> ### Title: Level Plot of a Matrix of p-values.
> ### Aliases: PMplot
> 
> ### ** Examples
> 
>   library(predictmeans)
>   set.seed(2013)
>   pvalues <- runif(28)
>   pmatrix <- matrix(0,8,8)
>   pmatrix[lower.tri(pmatrix)] <- pvalues
>   round(pmatrix, 4)
       [,1]   [,2]   [,3]   [,4]   [,5]   [,6]   [,7] [,8]
[1,] 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000    0
[2,] 0.4633 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000    0
[3,] 0.9523 0.7986 0.0000 0.0000 0.0000 0.0000 0.0000    0
[4,] 0.7849 0.9342 0.8579 0.0000 0.0000 0.0000 0.0000    0
[5,] 0.7635 0.8197 0.6238 0.0773 0.0000 0.0000 0.0000    0
[6,] 0.2522 0.0046 0.7151 0.3296 0.0745 0.0000 0.0000    0
[7,] 0.7263 0.2472 0.9783 0.5498 0.8099 0.4634 0.0000    0
[8,] 0.9132 0.7540 0.9412 0.0451 0.2713 0.1563 0.6729    0
>   PMplot(pmatrix)
dev.new(): using pdf(file="Rplots1.pdf")
> 
>   Oats$nitro <- factor(Oats$nitro)
>   fm <- lmer(yield ~ nitro*Variety+(1|Block/Variety), data=Oats)
>   predictout <- predictmeans(fm, "nitro:Variety", atvar="Variety", adj="BH", barplot=TRUE)
Warning in if (class(object) %in% c("matrix", "Matrix")) { :
  the condition has length > 1 and only the first element will be used
Warning in if (class(object) %in% c("matrix", "Matrix")) { :
  the condition has length > 1 and only the first element will be used
Warning in if (class(object) %in% c("matrix", "Matrix")) { :
  the condition has length > 1 and only the first element will be used
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
predictmeans
 --- call from context --- 
multcompLetters(Grpatvar.pm, Letters = LETTERS, threshold = slevel)
 --- call from argument --- 
if (class(x) == "dist") x <- as.matrix(x)
 --- R stacktrace ---
where 1: multcompLetters(Grpatvar.pm, Letters = LETTERS, threshold = slevel)
where 2: cbind(outtab, Group = multcompLetters(Grpatvar.pm, Letters = LETTERS, 
    threshold = slevel)[resvar.levels])
where 3: as.table(cbind(outtab, Group = multcompLetters(Grpatvar.pm, Letters = LETTERS, 
    threshold = slevel)[resvar.levels]))
where 4: predictmeans(fm, "nitro:Variety", atvar = "Variety", adj = "BH", 
    barplot = TRUE)

 --- value of length: 2 type: logical ---
[1] FALSE FALSE
 --- function from context --- 
function (x, compare = "<", threshold = 0.05, Letters = c(letters, 
    LETTERS, "."), reversed = FALSE) 
{
    x.is <- deparse(substitute(x))
    if (class(x) == "dist") 
        x <- as.matrix(x)
    if (!is.logical(x)) 
        x <- do.call(compare, list(x, threshold))
    dimx <- dim(x)
    {
        if ((length(dimx) == 2) && (dimx[1] == dimx[2])) {
            Lvls <- dimnames(x)[[1]]
            if (length(Lvls) != dimx[1]) 
                stop("Names requred for ", x.is)
            else {
                x2. <- t(outer(Lvls, Lvls, paste, sep = ""))
                x2.n <- outer(Lvls, Lvls, function(x1, x2) nchar(x2))
                x2.2 <- x2.[lower.tri(x2.)]
                x2.2n <- x2.n[lower.tri(x2.n)]
                x2a <- substring(x2.2, 1, x2.2n)
                x2b <- substring(x2.2, x2.2n + 1)
                x2 <- cbind(x2a, x2b)
                x <- x[lower.tri(x)]
            }
        }
        else {
            namx <- names(x)
            if (length(namx) != length(x)) 
                stop("Names required for ", x.is)
            x2 <- vec2mat2(namx)
            Lvls <- unique(as.vector(x2))
        }
    }
    n <- length(Lvls)
    LetMat <- array(TRUE, dim = c(n, 1), dimnames = list(Lvls, 
        NULL))
    k2 <- sum(x)
    if (k2 == 0) {
        Ltrs <- rep(Letters[1], n)
        names(Ltrs) <- Lvls
        dimnames(LetMat)[[2]] <- Letters[1]
        return(Ltrs)
    }
    distinct.pairs <- x2[x, , drop = FALSE]
    absorb <- function(A.) {
        k. <- dim(A.)[2]
        if (k. > 1) {
            for (i. in 1:(k. - 1)) for (j. in (i. + 1):k.) {
                if (all(A.[A.[, j.], i.])) {
                  A. <- A.[, -j., drop = FALSE]
                  return(absorb(A.))
                }
                else {
                  if (all(A.[A.[, i.], j.])) {
                    A. <- A.[, -i., drop = FALSE]
                    return(absorb(A.))
                  }
                }
            }
        }
        A.
    }
    for (i in 1:k2) {
        dpi <- distinct.pairs[i, ]
        ijCols <- (LetMat[dpi[1], ] & LetMat[dpi[2], ])
        if (any(ijCols)) {
            A1 <- LetMat[, ijCols, drop = FALSE]
            A1[dpi[1], ] <- FALSE
            LetMat[dpi[2], ijCols] <- FALSE
            LetMat <- cbind(LetMat, A1)
            LetMat <- absorb(LetMat)
        }
    }
    sortCols <- function(B) {
        firstRow <- apply(B, 2, function(x) which(x)[1])
        B <- B[, order(firstRow)]
        firstRow <- apply(B, 2, function(x) which(x)[1])
        reps <- (diff(firstRow) == 0)
        if (any(reps)) {
            nrep <- table(which(reps))
            irep <- as.numeric(names(nrep))
            k <- dim(B)[1]
            for (i in irep) {
                i. <- i:(i + nrep[as.character(i)])
                j. <- (firstRow[i] + 1):k
                B[j., i.] <- sortCols(B[j., i., drop = FALSE])
            }
        }
        B
    }
    LetMat. <- sortCols(LetMat)
    if (reversed) 
        LetMat. <- LetMat.[, rev(1:ncol(LetMat.))]
    k.ltrs <- dim(LetMat.)[2]
    makeLtrs <- function(kl, ltrs = Letters) {
        kL <- length(ltrs)
        if (kl < kL) 
            return(ltrs[1:kl])
        ltrecurse <- c(paste(ltrs[kL], ltrs[-kL], sep = ""), 
            ltrs[kL])
        c(ltrs[-kL], makeLtrs(kl - kL + 1, ltrecurse))
    }
    Ltrs <- makeLtrs(k.ltrs, Letters)
    dimnames(LetMat.)[[2]] <- Ltrs
    LetVec <- rep(NA, n)
    names(LetVec) <- Lvls
    for (i in 1:n) LetVec[i] <- paste(Ltrs[LetMat.[i, ]], collapse = "")
    nch.L <- nchar(Ltrs)
    blk.L <- rep(NA, k.ltrs)
    for (i in 1:k.ltrs) blk.L[i] <- paste(rep(" ", nch.L[i]), 
        collapse = "")
    monoVec <- rep(NA, n)
    names(monoVec) <- Lvls
    for (j in 1:n) {
        ch2 <- blk.L
        if (any(LetMat.[j, ])) 
            ch2[LetMat.[j, ]] <- Ltrs[LetMat.[j, ]]
        monoVec[j] <- paste(ch2, collapse = "")
    }
    return(monoVec)
}
<bytecode: 0xa8a1798>
<environment: namespace:predictmeans>
 --- function search by body ---
Function multcompLetters in namespace predictmeans has this body.
 ----------- END OF FAILURE REPORT -------------- 
Error in if (class(x) == "dist") x <- as.matrix(x) : 
  the condition has length > 1
Calls: predictmeans -> as.table -> cbind -> multcompLetters
Execution halted