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

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: writeLMToTPS
> ### Title: Writes landmarks as TPS file
> ### Aliases: writeLMToTPS
> 
> ### ** Examples
> 
> # Get the path to package example files
> fdir <- paste0(path.package("StereoMorph"), "/extdata/")
> 
> # Write 2D landmark pixel coordinates from a single shape file to TPS
> writeLMToTPS(paste0(fdir, 'Shapes_2D/mug_003.txt'), 'Mug_2D.tps')
> 
> # Write 3D landmark coordinates from a single shape file to TPS
> writeLMToTPS(paste0(fdir, 'Shapes_3D/bubo_virginianus_FMNH488595.txt'), 'Owl_3D.tps')
> 
> # Write 2D landmark pixel coordinates from multiple shape file to TPS
> writeLMToTPS(paste0(fdir, 'Shapes_2D'), 'Shapes_2D.tps')
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
StereoMorph
 --- call from context --- 
readShapes(shapes.file)
 --- call from argument --- 
if (class(read_shapes[[i]][[name]]) %in% c("character", "numeric")) {
    dims[[name]] <- list(type = "vector", length = length(file))
}
 --- R stacktrace ---
where 1: readShapes(shapes.file)
where 2: writeLMToTPS(paste0(fdir, "Shapes_2D"), "Shapes_2D.tps")

 --- value of length: 2 type: logical ---
[1] FALSE FALSE
 --- function from context --- 
function (file, fields = NULL) 
{
    file <- gsub("/.txt", "/", file)
    fields_internal <- fields
    if (!is.null(fields_internal)) {
        fields_internal <- unique(c(fields, "image.id"))
    }
    if (!grepl("[.]txt$", file[1])) {
        if (!file.exists(file)) 
            stop(paste0("'", file, "' not found."))
        file <- paste0(gsub("/+$", "", file), "/", list.files(file))
    }
    str_split <- strsplit(file, "/")
    last_name <- rep(NA, length(file))
    last2_name <- rep(NA, length(file))
    for (i in 1:length(str_split)) {
        last_name[i] <- tail(str_split[[i]], 1)
        if (length(str_split[[i]]) > 1) 
            last2_name[i] <- str_split[[i]][length(str_split[[i]]) - 
                1]
    }
    if (length(unique(last_name)) == length(file)) {
        filenames <- gsub("[.]txt$", "", last_name)
    }
    else if (length(unique(last2_name)) == length(file)) {
        filenames <- last2_name
    }
    else {
        filenames <- 1:length(file)
    }
    if (length(file) == 1) {
        rlist <- readXML4R(file)$shapes
    }
    else {
        dims <- list()
        read_shapes <- list()
        for (i in 1:length(file)) {
            read_xml4r <- readXML4R(file[i])
            if (is.null(read_xml4r$shapes)) 
                next
            read_shapes[[i]] <- read_xml4r$shapes
            for (name in names(read_shapes[[i]])) {
                if (!name %in% names(dims)) 
                  dims[[name]] <- list()
                if (class(read_shapes[[i]][[name]]) %in% c("character", 
                  "numeric")) {
                  dims[[name]] <- list(type = "vector", length = length(file))
                }
                if (class(read_shapes[[i]][[name]]) %in% c("matrix")) {
                  if (!"nrow" %in% names(dims[[name]])) {
                    dims[[name]] <- list(type = "matrix", nrow = rep(NA, 
                      length(file)), ncol = rep(NA, length(file)), 
                      rownames = c(), colnames = c())
                  }
                  dims[[name]][["nrow"]][i] <- nrow(read_shapes[[i]][[name]])
                  dims[[name]][["ncol"]][i] <- ncol(read_shapes[[i]][[name]])
                  if (!is.null(rownames(read_shapes[[i]][[name]]))) 
                    dims[[name]][["rownames"]] <- unique(c(dims[[name]][["rownames"]], 
                      rownames(read_shapes[[i]][[name]])))
                  if (!is.null(colnames(read_shapes[[i]][[name]]))) 
                    dims[[name]][["colnames"]] <- unique(c(dims[[name]][["colnames"]], 
                      colnames(read_shapes[[i]][[name]])))
                }
                if (class(read_shapes[[i]][[name]]) %in% c("list") && 
                  length(read_shapes[[i]][[name]]) > 0) {
                  dims[[name]] <- list(type = "list", length = length(file))
                }
            }
        }
        rlist <- list()
        for (name in names(dims)) {
            if (!is.null(fields_internal)) 
                if (!name %in% fields_internal) 
                  next
            if (length(dims[[name]]) == 0) 
                next
            if (dims[[name]][["type"]] == "vector") {
                rlist[[name]] <- rep(NA, length(file))
                names(rlist[[name]]) <- filenames
            }
            if (dims[[name]][["type"]] == "matrix") {
                nrow <- max(dims[[name]][["nrow"]], na.rm = TRUE)
                if (!is.null(dims[[name]][["rownames"]])) 
                  nrow <- length(dims[[name]][["rownames"]])
                ncol <- max(dims[[name]][["ncol"]], na.rm = TRUE)
                if (!is.null(dims[[name]][["colnames"]])) 
                  ncol <- length(dims[[name]][["colnames"]])
                rlist[[name]] <- array(NA, dim = c(nrow, ncol, 
                  length(file)), dimnames = list(dims[[name]][["rownames"]], 
                  dims[[name]][["colnames"]], filenames))
            }
            if (dims[[name]][["type"]] == "list") {
                rlist[[name]] <- list()
            }
        }
        for (i in 1:length(read_shapes)) {
            for (name in names(rlist)) {
                if (is.null(read_shapes[[i]][[name]])) 
                  next
                if (length(read_shapes[[i]][[name]]) == 0) 
                  next
                if (!is.null(fields_internal)) 
                  if (!name %in% fields_internal) 
                    next
                if (dims[[name]][["type"]] == "vector") 
                  rlist[[name]][i] <- read_shapes[[i]][[name]]
                if (dims[[name]][["type"]] == "matrix") {
                  row_idx <- 1:nrow(read_shapes[[i]][[name]])
                  if (!is.null(rownames(read_shapes[[i]][[name]]))) 
                    row_idx <- rownames(read_shapes[[i]][[name]])
                  col_idx <- 1:ncol(read_shapes[[i]][[name]])
                  if (!is.null(colnames(read_shapes[[i]][[name]]))) 
                    col_idx <- colnames(read_shapes[[i]][[name]])
                  rlist[[name]][row_idx, col_idx, i] <- read_shapes[[i]][[name]][row_idx, 
                    col_idx]
                }
                if (dims[[name]][["type"]] == "list") {
                  if (length(read_shapes[[i]][[name]]) == 0) {
                    rlist[[name]][[filenames[i]]] <- NULL
                  }
                  else {
                    rlist[[name]][[filenames[i]]] <- read_shapes[[i]][[name]]
                  }
                }
            }
        }
    }
    if (!is.null(fields)) 
        for (name in names(rlist)) if (!name %in% fields) 
            rlist[[name]] <- NULL
    for (name in names(rlist)) if (length(rlist[[name]]) == 0) 
        rlist[[name]] <- NULL
    if (!is.null(rlist)) 
        class(rlist) <- "shapes"
    rlist
}
<bytecode: 0x56123a6a8bd0>
<environment: namespace:StereoMorph>
 --- function search by body ---
Function readShapes in namespace StereoMorph has this body.
 ----------- END OF FAILURE REPORT -------------- 
Fatal error: the condition has length > 1