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

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: mt_align_start
> ### Title: Align start position of trajectories.
> ### Aliases: mt_align_start
> 
> ### ** Examples
> 
> # Import raw trajectories for demonstration
> mt_example <- mt_import_mousetrap(mt_example_raw)
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
mousetrap
 --- call from context --- 
mt_import_mousetrap(mt_example_raw)
 --- call from argument --- 
if (class(data_list) == "matrix") {
    max_logs <- max(sapply(data_list, length))
} else {
    max_logs <- dim(data_list)[1]
}
 --- R stacktrace ---
where 1: mt_import_mousetrap(mt_example_raw)

 --- value of length: 2 type: logical ---
[1]  TRUE FALSE
 --- function from context --- 
function (raw_data, xpos_label = "xpos", ypos_label = "ypos", 
    timestamps_label = "timestamps", mt_id_label = NULL, split = ",", 
    duplicates = "remove_first", reset_timestamps = TRUE, verbose = FALSE) 
{
    timestamps <- "timestamps"
    xpos <- "xpos"
    ypos <- "ypos"
    raw_data <- as.data.frame(raw_data)
    if (is.null(mt_id_label)) {
        if (verbose) {
            message("No mt_id_label provided. ", "A new trial identifying variable called mt_id was created.")
        }
        ids <- 1:nrow(raw_data)
        raw_data[, "mt_id"] <- paste("id", formatC(ids, width = trunc(log10(nrow(raw_data))) + 
            1, flag = "0"), sep = "")
    }
    else {
        ids <- as.character(raw_data[, mt_id_label[[1]]])
        if (length(mt_id_label) > 1) {
            for (var in mt_id_label[-1]) {
                ids <- paste0(ids, "_", raw_data[, var])
            }
        }
        raw_data[, "mt_id"] <- ids
        if (anyDuplicated(ids) > 0) {
            stop("Values in specified mt_id_label variable are not unique.")
        }
    }
    rownames(raw_data) <- raw_data[, "mt_id"]
    n_labels <- c(length(xpos_label), length(ypos_label), length(timestamps_label))
    if (any(n_labels > 1)) {
        if (any(n_labels != n_labels[1])) {
            stop("xpos_label, ypos_label, and timestamps_label differ in their length.")
        }
        join_data <- function(m) {
            m[is.na(m)] <- ""
            return(apply(m, MARGIN = 1, paste, collapse = split))
        }
        raw_data[, timestamps_label[1]] <- join_data(raw_data[, 
            timestamps_label, drop = FALSE])
        raw_data[, xpos_label[1]] <- join_data(raw_data[, xpos_label, 
            drop = FALSE])
        raw_data[, ypos_label[1]] <- join_data(raw_data[, ypos_label, 
            drop = FALSE])
        mt_labels <- c(timestamps_label[1], xpos_label[1], ypos_label[1])
        names(mt_labels) <- c(timestamps, xpos, ypos)
        columns <- mt_labels
        names(columns) <- mt_labels
    }
    else {
        check_columns <- function(var) {
            colname <- grep(paste0("^", var), colnames(raw_data), 
                value = TRUE)
            if (length(colname) == 1) {
                return(colname)
            }
            else if (length(colname) > 0) {
                stop(paste("More than one variable in data.frame starts with the label", 
                  var, "- please specify a unique label."))
            }
            else {
                stop("No variable in data.frame starts with the label ", 
                  var, " - please specify a correct variable.")
            }
        }
        mt_labels <- c(timestamps_label, xpos_label, ypos_label)
        names(mt_labels) <- c(timestamps, xpos, ypos)
        columns <- sapply(mt_labels, check_columns)
        names(columns) <- mt_labels
    }
    split_raw_data <- function(x) {
        x <- gsub(pattern = paste0("[^-0123456789.", split, "]"), 
            replacement = "", x)
        x <- gsub(pattern = paste0("^", split), replacement = "", 
            x)
        x <- gsub(pattern = paste0(split, "$"), replacement = "", 
            x)
        x <- gsub(pattern = paste0(split, split), replacement = "", 
            x)
        x <- strsplit(x, split = split)
        return(as.numeric(unlist(x)))
    }
    data_list <- apply(raw_data[, columns], c(1, 2), split_raw_data)
    if (class(data_list) == "matrix") {
        max_logs <- max(sapply(data_list, length))
    }
    else {
        max_logs <- dim(data_list)[1]
    }
    trajectories <- array(dim = c(nrow(raw_data), max_logs, 3), 
        dimnames = list(raw_data[, "mt_id"], NULL, c(timestamps, 
            xpos, ypos)))
    for (i in 1:dim(trajectories)[1]) {
        if (class(data_list) == "matrix") {
            for (j in names(mt_labels)) {
                mt_l <- columns[mt_labels[j]]
                if (length(data_list[i, ][[mt_l]]) > 0) {
                  trajectories[i, 1:length(data_list[i, ][[mt_l]]), 
                    j] <- data_list[i, ][[mt_l]]
                }
            }
        }
        else {
            trajectories[i, , timestamps] <- data_list[, i, columns[timestamps_label]]
            trajectories[i, , xpos] <- data_list[, i, columns[xpos_label]]
            trajectories[i, , ypos] <- data_list[, i, columns[ypos_label]]
        }
        current_timestamps <- trajectories[i, , timestamps]
        current_timestamps <- current_timestamps[1:sum(!is.na(current_timestamps))]
        if (any(diff(current_timestamps) < 0)) {
            warning("For some trajectories, timestamps are not monotonically increasing.")
        }
        if (duplicates != "ignore") {
            if (duplicates %in% c("remove_first", "remove_last")) {
                if (anyDuplicated(current_timestamps) > 0) {
                  current_xpos <- trajectories[i, 1:length(current_timestamps), 
                    xpos]
                  current_ypos <- trajectories[i, 1:length(current_timestamps), 
                    ypos]
                  trajectories[i, , ] <- NA
                  keep <- !duplicated(current_timestamps, fromLast = duplicates == 
                    "remove_first")
                  current_timestamps <- current_timestamps[keep]
                  trajectories[i, 1:length(current_timestamps), 
                    timestamps] <- current_timestamps
                  trajectories[i, 1:length(current_timestamps), 
                    xpos] <- current_xpos[keep]
                  trajectories[i, 1:length(current_timestamps), 
                    ypos] <- current_ypos[keep]
                }
            }
            else {
                stop("Please specify correct value for duplicates: ", 
                  "ignore, remove_first, or remove_last")
            }
        }
        if (verbose && i%%100 == 0) {
            message(paste(i, "trials finished"))
        }
    }
    if (verbose) {
        message(paste("all", i, "trials finished"))
    }
    if (any(is.na(trajectories[, 1, ]))) {
        na_trials <- rowSums(is.na(trajectories[, 1, , drop = FALSE]))
        warning(paste("The following trials do not contain any logging data for at least one variable:", 
            paste(names(na_trials[na_trials > 0]), collapse = ", ")))
    }
    nlogs <- apply(trajectories, c(1, 3), function(x) {
        sum(!is.na(x))
    })
    nlogs_sd <- apply(nlogs, 1, stats::sd)
    if (any(nlogs_sd > 0)) {
        warning(paste("In the following trials, the number of logs is not the same for all variables:", 
            paste(names(nlogs_sd[nlogs_sd > 0]), collapse = ", ")))
    }
    if (reset_timestamps) {
        trajectories[, , timestamps] <- trajectories[, , timestamps] - 
            trajectories[, 1, timestamps]
    }
    if (any(n_labels > 1)) {
        raw_data <- raw_data[, !colnames(raw_data) %in% c(timestamps_label, 
            xpos_label, ypos_label)]
    }
    else {
        raw_data <- raw_data[, !colnames(raw_data) %in% columns]
    }
    result <- c(list(data = raw_data, trajectories = trajectories))
    class(result) <- "mousetrap"
    return(result)
}
<bytecode: 0x49e3970>
<environment: namespace:mousetrap>
 --- function search by body ---
Function mt_import_mousetrap in namespace mousetrap has this body.
 ----------- END OF FAILURE REPORT -------------- 
Fatal error: the condition has length > 1