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

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: corridor
> ### Title: Visualize corridors between two points using a grains of
> ###   connectivity (GOC)
> ### Aliases: corridor corridor,goc-method
> 
> ### ** Examples
> 
> ## Load raster landscape
> tiny <- raster::raster(system.file("extdata/tiny.asc", package = "grainscape"))
> 
> ## Create a resistance surface from a raster using an is-becomes reclassification
> tinyCost <- raster::reclassify(tiny, rcl = cbind(c(1, 2, 3, 4), c(1, 5, 10, 12)))
> 
> ## Produce a patch-based MPG where patches are resistance features=1
> tinyPatchMPG <- MPG(cost = tinyCost, patch = tinyCost == 1)
> 
> ## Extract a representative subset of 5 grains of connectivity
> tinyPatchGOC <- GOC(tinyPatchMPG, nThresh = 5)
> 
> ## Quick visualization of a corridor
> corridorStartEnd <- rbind(c(10, 10), c(90, 90))
> tinyPatchCorridor <- corridor(tinyPatchGOC, whichThresh = 3, coords = corridorStartEnd)
 ----------- FAILURE REPORT -------------- 
 --- failure: the condition has length > 1 ---
 --- srcref --- 
: 
 --- package (from environment) --- 
grainscape
 --- call from context --- 
.local(x, ...)
 --- call from argument --- 
if (class(coords) %in% c("SpatialPoints", "SpatialPointsDataFrame")) {
    coords <- coordinates(coords)
}
 --- R stacktrace ---
where 1: .local(x, ...)
where 2: corridor(tinyPatchGOC, whichThresh = 3, coords = corridorStartEnd)
where 3: corridor(tinyPatchGOC, whichThresh = 3, coords = corridorStartEnd)

 --- value of length: 2 type: logical ---
[1] FALSE FALSE
 --- function from context --- 
function (x, whichThresh, coords, weight = "meanWeight", ...) 
{
    dots <- list(...)
    if (!is.null(dots$doPlot)) {
        warning("Argument 'doPlot' is deprecated and will be ignored.")
    }
    if ((length(whichThresh) > 1) || (!(whichThresh %in% 1:length(x@th)))) {
        stop("whichThresh must index a single threshold existing in the GOC object")
    }
    if (class(coords) %in% c("SpatialPoints", "SpatialPointsDataFrame")) {
        coords <- coordinates(coords)
    }
    if (ncol(coords) != 2) {
        stop("coords must be a SpatialPoints object or a matrix of two columns", 
            "giving X and Y coordinates")
    }
    if (nrow(coords) > 2) {
        warning("using only first two sets of coordinates for corridor start and end points")
        coords <- coords[1:2, ]
    }
    if (!(weight %in% names(edge_attr(x@th[[1]]$goc)))) {
        stop("link weight attribute with this name doesn't exist in GOC object")
    }
    edges <- as_edgelist(x@th[[whichThresh]]$goc)
    edges <- cbind(edgeNum = 1:nrow(edges), v1 = sapply(edges[, 
        1], function(z) {
        which(V(x@th[[whichThresh]]$goc)$name == z)
    }), v2 = sapply(edges[, 2], function(z) {
        which(V(x@th[[whichThresh]]$goc)$name == z)
    }))
    edgesGOC <- apply(edges, 1, function(i) {
        cbind(c(V(x@th[[whichThresh]]$goc)$centroidX[i["v1"]], 
            V(x@th[[whichThresh]]$goc)$centroidX[i["v2"]]), c(V(x@th[[whichThresh]]$goc)$centroidY[i["v1"]], 
            V(x@th[[whichThresh]]$goc)$centroidY[i["v2"]])) %>% 
            Line() %>% Lines(ID = as.character(i["edgeNum"]))
    }) %>% SpatialLines() %>% SpatialLinesDataFrame(data = data.frame(edgeNum = 1:nrow(edges), 
        weight = edge_attr(x@th[[whichThresh]]$goc, weight)))
    verticesGOC <- SpatialPoints(cbind(V(x@th[[whichThresh]]$goc)$centroidX, 
        V(x@th[[whichThresh]]$goc)$centroidY))
    startEndPolygons <- point(x, coords)$pointPolygon[, whichThresh]
    pths <- shortest_paths(x@th[[whichThresh]]$goc, which(V(x@th[[whichThresh]]$goc)$polygonId == 
        na.omit(startEndPolygons[1])), which(V(x@th[[whichThresh]]$goc)$polygonId == 
        na.omit(startEndPolygons[2])), weights = V(x@th[[whichThresh]]$goc)$meanWeight)
    startEndPath <- if (length(pths$vpath) > 0) {
        pths %>% 1[[]] %>% 1[[]] %>% as.numeric()
    }
    else {
        stop("corridor: all 'coords' correspond to cells of value 'NA'.")
    }
    shortestPathEdges <- cbind(V(x@th[[whichThresh]]$goc)$centroidX[startEndPath], 
        V(x@th[[whichThresh]]$goc)$centroidY[startEndPath]) %>% 
        Line() %>% Lines(ID = "1") %>% list() %>% SpatialLines()
    shortestPathVertices <- SpatialPoints(cbind(V(x@th[[whichThresh]]$goc)$centroidX[startEndPath], 
        V(x@th[[whichThresh]]$goc)$centroidY[startEndPath]))
    pathDist <- distances(x@th[[whichThresh]]$goc, v = V(x@th[[whichThresh]]$goc)[na.omit(startEndPath[1])], 
        weights = edge_attr(x@th[[whichThresh]]$goc, weight))[na.omit(startEndPath[length(startEndPath)])]
    voronoiBound <- boundaries(grain(x, whichThresh = whichThresh)@voronoi, 
        classes = TRUE)
    result <- new("corridor", voronoi = voronoiBound, linksSP = edgesGOC, 
        nodesSP = verticesGOC, shortestLinksSP = shortestPathEdges, 
        shortestNodesSP = shortestPathVertices, corridorLength = pathDist)
    return(result)
}
<environment: namespace:grainscape>
 --- function search by body ---
 ----------- END OF FAILURE REPORT -------------- 
Fatal error: the condition has length > 1