Running examples in 'basicMCMCplots-Ex.R' failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: samplesPlot
> ### Title: Plot MCMC traceplots and density plots
> ### Aliases: samplesPlot
> 
> ### ** Examples
> 
> samples <- cbind(rnorm(1000), rgamma(1000, 1))
> colnames(samples) <- c('alpha', 'beta')
> samplesPlot(samples)
dev.new(): using pdf(file="Rplots4.pdf")
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
basicMCMCplots
 --- call from context --- 
samplesPlot(samples)
 --- call from argument --- 
if (class(samples) == "numeric") {
    samples <- matrix(samples, ncol = 1)
    colnames(samples) <- "var"
    var <- "var"
}
 --- R stacktrace ---
where 1: samplesPlot(samples)

 --- value of length: 2 type: logical ---
[1] FALSE FALSE
 --- function from context --- 
function (samples, var = colnames(samples), ind = NULL, burnin = NULL, 
    scale = FALSE, width = 7, height = 4, legend = TRUE, legend.location = "topright", 
    traceplot = TRUE, densityplot = TRUE, file = NULL) 
{
    if (!is.null(file)) 
        pdf(file, width = width, height = height)
    else if (inherits(try(eval(parse(text = "knitr::opts_chunk$get('dev')")[[1]]), 
        silent = TRUE), "try-error") || is.null(eval(parse(text = "knitr::opts_chunk$get('dev')")[[1]]))) 
        dev.new(height = height, width = width)
    par.save <- par(no.readonly = TRUE)
    par(mfrow = c(1, traceplot + densityplot), cex = 0.7, cex.main = 1.5, 
        cex.axis = 0.9, lab = c(3, 3, 7), mgp = c(0, 0.4, 0), 
        mar = c(1.6, 1.6, 2, 0.6), oma = c(0, 0, 0, 0), tcl = -0.3, 
        bty = "l")
    if (is.list(samples)) 
        samples <- samples[[1]]
    if (class(samples) == "numeric") {
        samples <- matrix(samples, ncol = 1)
        colnames(samples) <- "var"
        var <- "var"
    }
    var <- gsub("\\[", "\\\\\\[", gsub("\\]", "\\\\\\]", var))
    var <- unlist(lapply(var, function(n) grep(paste0("^", n, 
        "(\\[.+\\])?$"), colnames(samples), value = TRUE)))
    samples <- samples[, var, drop = FALSE]
    if (dim(samples)[2] == 0) 
        stop("variable names misspelled", call. = FALSE)
    if (scale) 
        samples <- apply(samples, 2, scale)
    if (!is.null(ind) && !is.null(burnin)) 
        stop("only specify either ind or burnin")
    if (!is.null(ind)) 
        samples <- samples[ind, , drop = FALSE]
    if (!is.null(burnin)) 
        samples <- samples[(burnin + 1):dim(samples)[1], , drop = FALSE]
    nparam <- ncol(samples)
    rng <- range(samples)
    if (!traceplot & !densityplot) 
        stop("both traceplot and densityplot are false")
    if (traceplot) {
        plot(1:nrow(samples), ylim = rng, type = "n", main = "Traceplots", 
            xlab = "", ylab = "")
        for (i in 1:nparam) lines(samples[, i], col = rainbow(nparam, 
            alpha = 0.75)[i])
        if (legend & !densityplot & !is.null(dimnames(samples)) & 
            is.character(dimnames(samples)[[2]])) 
            legend(legend = dimnames(samples)[[2]], fill = rainbow(nparam, 
                alpha = 0.5), bty = "n", x = legend.location)
    }
    if (densityplot) {
        xMin <- xMax <- yMax <- NULL
        for (i in 1:nparam) {
            d <- density(samples[, i])
            xMin <- min(xMin, d$x)
            xMax <- max(xMax, d$x)
            yMax <- max(yMax, d$y)
        }
        plot(1, xlim = c(xMin, xMax), ylim = c(0, yMax), type = "n", 
            main = "Posterior Densities", xlab = "", ylab = "", 
            yaxt = "n")
        for (i in 1:nparam) polygon(density(samples[, i]), col = rainbow(nparam, 
            alpha = 0.2)[i], border = rainbow(nparam, alpha = 0.2)[i])
        if (legend & !is.null(dimnames(samples)) & is.character(dimnames(samples)[[2]])) 
            legend(legend = dimnames(samples)[[2]], fill = rainbow(nparam, 
                alpha = 0.5), bty = "n", x = legend.location)
    }
    invisible(par(par.save))
    if (!is.null(file)) 
        dev.off()
}
<bytecode: 0x2f74758>
<environment: namespace:basicMCMCplots>
 --- function search by body ---
Function samplesPlot in namespace basicMCMCplots has this body.
 ----------- END OF FAILURE REPORT -------------- 
Error in if (class(samples) == "numeric") { : 
  the condition has length > 1
Calls: samplesPlot
Execution halted