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

> ### Name: hamlet-package
> ### Title: Hierarchical Optimal Matching and Machine Learning Toolbox
> ### Aliases: hamlet-package hamlet
> ### Keywords: package
> 
> ### ** Examples
> 
> 
> ##
> ## Exploring the VCaP dataset provided alongside the 'hamlet' package
> ##
> 
> data(vcapwide)
> data(vcaplong)
> 
> # VCaP Castration-resistant prostate cancer (CRPC) PSA-measurements (and body weight) in wide-format
> mixplot(vcapwide[,c("PSAWeek10", "PSAWeek14", "BWWeek10", "Group")], pch=16)
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
hamlet
 --- call from context --- 
mixplot(vcapwide[, c("PSAWeek10", "PSAWeek14", "BWWeek10", "Group")], 
    pch = 16)
 --- call from argument --- 
if (class(x) == "data.frame") {
    colclass <- lapply(x, FUN = class)
} else if (class(x) == "matrix") {
    colclass <- class(x[1, 1])
} else {
    x <- as.data.frame(x)
    colclass <- lapply(x, FUN = class)
}
 --- R stacktrace ---
where 1: mixplot(vcapwide[, c("PSAWeek10", "PSAWeek14", "BWWeek10", "Group")], 
    pch = 16)

 --- value of length: 2 type: logical ---
[1] FALSE FALSE
 --- function from context --- 
function (x, main = NA, match, func = function(x, y, par) {
    segments(x0 = x[1], y0 = x[2], x1 = y[1], y1 = y[2], col = par)
}, legend = T, col = palette(), na.lines = T, origin = F, marginal = F, 
    lhei, lwid, verb = 0, ...) 
{
    def.par <- par(no.readonly = TRUE)
    verb <- as.numeric(verb)
    marginal <- as.character(marginal)
    if (is.vector(x)) 
        x <- as.matrix(x)
    nums <- c("numeric", "integer", "logical")
    ctgr <- c("factor", "character")
    if (class(x) == "data.frame") {
        colclass <- lapply(x, FUN = class)
    }
    else if (class(x) == "matrix") {
        colclass <- class(x[1, 1])
    }
    else {
        x <- as.data.frame(x)
        colclass <- lapply(x, FUN = class)
    }
    wnum <- colclass %in% nums
    nnum <- sum(wnum)
    wcat <- colclass %in% ctgr
    ncat <- sum(wcat)
    if (ncat == 0) {
        cats <- rep("Observation", times = nrow(x))
        wcats <- rep(1, times = nrow(x))
    }
    else {
        cats <- apply(x[, wcat, drop = F], MARGIN = 1, FUN = function(x) paste(x, 
            collapse = ", "))
        wcats <- base::match(cats, unique(cats))
    }
    col <- rep(col, length.out = length(wcats))[wcats]
    if (missing(lhei)) {
        lhei <- c()
        if (!is.na(main)) 
            lhei <- c(lhei, 0.1)
        if (!as.character(marginal) %in% c("0", "FALSE", "no", 
            "none")) {
            lhei <- c(lhei, rep(c(0.05, 0.3), times = ifelse(nnum > 
                2, nnum, 1)))
        }
        else {
            lhei <- c(lhei, rep(0.3, times = ifelse(nnum > 2, 
                nnum, 1)))
        }
        if (legend) 
            lhei <- c(lhei, 0.1)
    }
    if (missing(lwid)) {
        if (!as.character(marginal) %in% c("0", "FALSE", "no", 
            "none")) {
            lwid <- rep(c(0.3, 0.05), times = ifelse(nnum > 2, 
                nnum, 1))
        }
        else {
            lwid <- rep(0.3, times = ifelse(nnum > 2, nnum, 1))
        }
    }
    subsize <- ifelse(!as.character(marginal) %in% c("0", "FALSE", 
        "no", "none"), 4, 1)
    if (subsize == 4) {
        temp <- rbind(rep(letters[1:2], times = ifelse(nnum > 
            2, nnum, 1)), rep(letters[3:4], times = ifelse(nnum > 
            2, nnum, 1)))[rep(1:2, times = ifelse(nnum > 2, nnum, 
            1)), ]
        temp[temp == "a"] <- seq(from = 1 + 0, to = 4 * (ifelse(nnum > 
            2, nnum, 1) * ifelse(nnum > 2, nnum, 1)) + 0, by = 4)
        temp[temp == "b"] <- seq(from = 1 + 1, to = 4 * (ifelse(nnum > 
            2, nnum, 1) * ifelse(nnum > 2, nnum, 1)) + 1, by = 4)
        temp[temp == "c"] <- seq(from = 1 + 2, to = 4 * (ifelse(nnum > 
            2, nnum, 1) * ifelse(nnum > 2, nnum, 1)) + 2, by = 4)
        temp[temp == "d"] <- seq(from = 1 + 3, to = 4 * (ifelse(nnum > 
            2, nnum, 1) * ifelse(nnum > 2, nnum, 1)) + 3, by = 4)
        class(temp) <- "numeric"
        lmat <- rbind(rep(1, times = length(lwid)), t(temp) + 
            1, rep(1 + max(temp) + 1, times = length(lwid)))
    }
    else {
        lmat <- rbind(rep(1, times = length(lwid)), matrix(2:(ifelse(nnum > 
            2, nnum, 1) * ifelse(nnum > 2, nnum, 1) + 1), ncol = nnum, 
            byrow = T), rep(1 + ifelse(nnum > 2, nnum, 1) * ifelse(nnum > 
            2, nnum, 1) + 1, times = length(lwid)))
    }
    if (is.na(main)) {
        lmat <- lmat - 1
        lmat <- lmat[-1, ]
    }
    if (!legend) {
        lmat <- lmat[-nrow(lmat), ]
    }
    if (as.numeric(verb) >= 1) {
        print("lmat")
        print(lmat)
        print("lwid")
        print(lwid)
        print("lhei")
        print(lhei)
    }
    l <- layout(lmat, widths = lwid, heights = lhei)
    if (!is.na(main)) {
        par(mar = c(0, 0, 0, 0))
        plot.new()
        plot.window(xlim = c(-1, 1), ylim = c(-1, 1))
        text(0, 0, main)
    }
    if (!missing(match)) {
        if (class(match) %in% c("matrix", "data.frame")) {
            match <- match.mat2vec(as.matrix(match))
        }
        mm <- unique(match)
        ms <- lapply(mm, function(z) which(match == z))
        ms <- lapply(ms, function(z) {
            if (length(z) > 1) {
                combn(z, 2)
            }
            else NA
        })
        if (verb >= 1) {
            print("Matching information processed:")
            print(ms)
        }
        plotmatch <- T
    }
    else {
        plotmatch <- F
    }
    subplox <- function(x, marginal, labels = F, plotmatch = F, 
        ...) {
        if (labels) {
            mar <- c(4, 4, 1, 1)
        }
        else {
            mar <- c(2, 2, 1, 1)
        }
        if (!as.character(marginal) %in% c("0", "FALSE", "no", 
            "none")) {
            martemp <- mar
            martemp[c(1, 3)] <- 0
            par(mar = martemp)
            plot.new()
            plot.window(xlim = grDevices::extendrange(x[, 1]), 
                ylim = c(-1, 1))
            if (any(as.character(marginal) %in% c("1", "TRUE", 
                "rug"))) {
                for (i in 1:nrow(x)) abline(v = x[i, 1], col = col[i], 
                  lwd = 2)
            }
            if (any(as.character(marginal) %in% c("2", "hist"))) {
                uniqs <- unique(wcats)
                hall <- hist(x[, 1], plot = F, breaks = seq(from = min(x[, 
                  1], na.rm = T), to = max(x[, 1], na.rm = T), 
                  length.out = 50))
                for (i in 1:length(uniqs)) {
                  h <- hist(x[wcats == uniqs[i], 1], plot = F, 
                    breaks = seq(from = min(x[, 1], na.rm = T), 
                      to = max(x[, 1], na.rm = T), length.out = 50))
                  for (j in 1:length(h$density)) {
                    d <- h$counts[j]/max(hall$counts)
                    rect(xleft = h$breaks[j], xright = h$breaks[j + 
                      1], ybottom = -1, ytop = unlist(ifelse(d > 
                      0, d, -1)), col = unique(col)[i], border = NA)
                  }
                }
            }
        }
        par(mar = mar)
        plot(x, xlim = extendrange(x[, 1]), ylim = extendrange(x[, 
            2]), ...)
        if (plotmatch) {
            lapply(1:length(ms), FUN = function(z) {
                if (is.matrix(ms[[z]])) 
                  lapply(1:ncol(ms[[z]]), FUN = function(q) {
                    func(x = as.numeric(x[ms[[z]][1, q], ]), 
                      y = as.numeric(x[ms[[z]][2, q], ]), par = z)
                  })
            })
        }
        if (origin) {
            abline(h = 0, col = "grey")
            abline(v = 0, col = "grey")
        }
        if (!as.character(marginal) %in% c("0", "FALSE", "no", 
            "none")) {
            par(mar = c(0, 0, 0, 0))
            plot.new()
            plot.window(xlim = c(-1, 1), ylim = c(-1, 1))
            martemp <- mar
            martemp[c(2, 4)] <- 0
            par(mar = martemp)
            plot.new()
            plot.window(xlim = c(-1, 1), ylim = extendrange(x[, 
                2]))
            if (any(as.character(marginal) %in% c("1", "TRUE", 
                "rug"))) {
                for (i in 1:nrow(x)) {
                  abline(h = x[i, 2], col = col[i], lwd = 2)
                }
            }
            if (any(as.character(marginal) %in% c("2", "hist"))) {
                uniqs <- unique(wcats)
                hall <- hist(x[, 2], plot = F, breaks = seq(from = min(x[, 
                  2], na.rm = T), to = max(x[, 2], na.rm = T), 
                  length.out = 50))
                for (i in 1:length(uniqs)) {
                  h <- hist(x[wcats == uniqs[i], 2], plot = F, 
                    breaks = seq(from = min(x[, 2], na.rm = T), 
                      to = max(x[, 2], na.rm = T), length.out = 50))
                  for (j in 1:length(h$density)) {
                    d <- h$counts[j]/max(hall$counts)
                    rect(ytop = h$breaks[j], ybottom = h$breaks[j + 
                      1], xleft = -1, xright = unlist(ifelse(d > 
                      0, d, -1)), col = unique(col)[i], border = NA)
                  }
                }
            }
        }
    }
    if (nnum == 1) {
        subplox(x = x[, which(wnum)[1]], marginal = marginal, 
            labels = T, col = col, plotmatch = plotmatch, ...)
    }
    else if (nnum == 2) {
        subplox(x = x[, which(wnum)[1:2]], marginal = marginal, 
            labels = T, col = col, plotmatch = plotmatch, ...)
    }
    else {
        for (row in 1:nnum) {
            for (column in 1:nnum) {
                if (verb >= 1) 
                  print(paste("row", row, "column", column))
                if (row == column) {
                  par(mar = c(0, 0, 0, 0))
                  if (!as.character(marginal) %in% c("0", "FALSE", 
                    "no", "none")) {
                    plot.new()
                    plot.window(xlim = c(-1, 1), ylim = c(-1, 
                      1))
                  }
                  plot.new()
                  plot.window(xlim = c(-1, 1), ylim = c(-1, 1))
                  text(0, 0, colnames(x)[which(wnum)[row]])
                  if (!as.character(marginal) %in% c("0", "FALSE", 
                    "no", "none")) {
                    plot.new()
                    plot.window(xlim = c(-1, 1), ylim = c(-1, 
                      1))
                    plot.new()
                    plot.window(xlim = c(-1, 1), ylim = c(-1, 
                      1))
                  }
                }
                else {
                  subplox(x = x[, rev(which(wnum)[c(row, column)])], 
                    marginal = marginal, col = col, plotmatch = plotmatch, 
                    ...)
                }
            }
        }
    }
    if (!as.numeric(legend) == 0) {
        par(mar = c(0, 0, 0, 0))
        plot.new()
        plot.window(xlim = c(-1, 1), ylim = c(-1, 1))
        if (verb >= 1) {
            print(col)
            print(wcats)
            print(cats)
        }
        legend("bottom", col = unique(col)[unique(wcats)], legend = unique(cats)[unique(wcats)], 
            horiz = T, bty = "n", ...)
    }
    par(def.par)
    invisible(list(x = x, lmat = lmat, lwid = lwid, lhei = lhei))
}
<bytecode: 0x29260d0>
<environment: namespace:hamlet>
 --- function search by body ---
Function mixplot in namespace hamlet has this body.
 ----------- END OF FAILURE REPORT -------------- 
Error in if (class(x) == "data.frame") { : the condition has length > 1
Calls: mixplot
Execution halted