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

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: slab-methods
> ### Title: Slab-Wise Aggregation of SoilProfileCollection Objects
> ### Aliases: slab slab2 genSlabLabels slab,SoilProfileCollection-method
> ### Keywords: methods manip
> 
> ### ** Examples
> 
> ##
> ## basic examples
> ##
> library(lattice)
> library(grid)
> 
> # load sample data, upgrade to SoilProfileCollection
> data(sp1)
> depths(sp1) <- id ~ top + bottom
> 
> # aggregate entire collection with two different segment sizes
> a <- slab(sp1, fm = ~ prop)
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
aqp
 --- call from context --- 
slab(sp1, fm = ~prop)
 --- call from argument --- 
if (class(d.slabbed$value) == "matrix") d.slabbed <- cbind(d.slabbed[, 
    1:3], d.slabbed$value)
 --- R stacktrace ---
where 1: slab(sp1, fm = ~prop)
where 2: slab(sp1, fm = ~prop)

 --- value of length: 2 type: logical ---
[1]  TRUE FALSE
 --- function from context --- 
Method Definition:

function (object, fm, slab.structure = 1, strict = FALSE, slab.fun = .slab.fun.numeric.default, 
    cpm = 1, weights = NULL, ...) 
{
    extra.args <- list(...)
    opt.original <- options(stringsAsFactors = FALSE)
    object.names <- unique(unlist(names(object)))
    n.profiles <- length(object)
    max.d <- max(object)
    object.ID <- idname(object)
    original.levels <- NULL
    g <- all.vars(update(fm, . ~ 0))
    vars <- all.vars(update(fm, 0 ~ .))
    if (!inherits(fm, "formula")) 
        stop("must provide a valid formula: groups ~ var1 + var2 + ...", 
            call. = FALSE)
    if (any(g %in% object.names) == FALSE & g != ".") 
        stop("group name either missing from formula, or does match any columns in dataframe", 
            call. = FALSE)
    if (any(vars %in% object.names) == FALSE) 
        stop("column names in formula do not match column names in dataframe", 
            call. = FALSE)
    fm.slice <- formula(paste("0:", max(object) - 1, " ~ ", paste(vars, 
        collapse = " + "), sep = ""))
    if (length(slab.structure) == 2) 
        fm.slice <- formula(paste(slab.structure[1], ":", slab.structure[2] - 
            1, " ~ ", paste(vars, collapse = " + "), sep = ""))
    data <- slice(object, fm.slice, strict = strict, just.the.data = TRUE)
    site.data <- site(object)
    if (g != ".") 
        if (any(is.na(site.data[, g]))) 
            stop("grouping variable must not contain NA", call. = FALSE)
    data <- join(data, site.data, by = object.ID)
    rm(object, site.data)
    gc()
    if (length(vars) > 1) 
        vars.numeric.test <- sapply(data[, vars], is.numeric)
    else vars.numeric.test <- is.numeric(data[[vars]])
    if (any(!vars.numeric.test) & length(vars) > 1) 
        stop("mixed variable types and multiple categorical variables are not currently supported in the same call to slab", 
            call. = FALSE)
    if (length(vars) == 1 & class(data[, vars]) %in% c("character", 
        "factor")) {
        if (class(data[[vars]]) == "character") {
            message("Note: converting categorical variable to factor.")
            data[[vars]] <- factor(data[[vars]])
        }
        if (!missing(weights)) 
            stop("weighted aggregation of categorical variables not yet implemented", 
                call. = FALSE)
        slab.fun <- .slab.fun.factor.default
        extra.args <- list(cpm = cpm)
        original.levels <- levels(data[[vars]])
    }
    data$seg.label <- genSlabLabels(slab.structure = slab.structure, 
        max.d = max.d, n.profiles = n.profiles)
    if (g == ".") {
        g <- "all.profiles"
        data[, g] <- 1
    }
    if (!missing(weights)) 
        stop("weighted aggregation is not yet supported", call. = FALSE)
    seg.label.is.not.NA <- which(!is.na(data$seg.label))
    d.long <- melt(data[seg.label.is.not.NA, ], id.vars = c(object.ID, 
        "seg.label", g), measure.vars = vars)
    aggregate.fm <- as.formula(paste("value ~ seg.label + variable + ", 
        g, sep = ""))
    if (length(extra.args) == 0) 
        d.slabbed <- aggregate(aggregate.fm, data = d.long, na.action = na.pass, 
            FUN = slab.fun)
    else {
        the.args <- c(list(formula = aggregate.fm, data = d.long, 
            na.action = na.pass, FUN = slab.fun), extra.args)
        d.slabbed <- do.call(what = "aggregate", args = the.args)
    }
    if (class(d.slabbed$value) == "matrix") 
        d.slabbed <- cbind(d.slabbed[, 1:3], d.slabbed$value)
    names(d.slabbed) <- make.names(names(d.slabbed))
    slab.depths <- strsplit(as.character(d.slabbed$seg.label), 
        "-")
    d.slabbed$top <- as.integer(lapply(slab.depths, function(i) i[1]))
    d.slabbed$bottom <- as.integer(lapply(slab.depths, function(i) i[2]))
    d.slabbed$contributing_fraction <- aggregate(aggregate.fm, 
        data = d.long, na.action = na.pass, FUN = function(i) {
            length(na.omit(i))/length(i)
        })$value
    d.slabbed$seg.label <- NULL
    if (!is.null(original.levels)) 
        attr(d.slabbed, "original.levels") <- original.levels
    options(opt.original)
    return(d.slabbed)
}
<bytecode: 0x560b24bbbfe8>
<environment: namespace:aqp>

Signatures:
        object                 
target  "SoilProfileCollection"
defined "SoilProfileCollection"
 --- function search by body ---
S4 Method slab:aqp defined in namespace aqp with signature SoilProfileCollection has this body.
 ----------- END OF FAILURE REPORT -------------- 
Fatal error: the condition has length > 1