Running ‘spelling.R’ [0s/1s]
  Running ‘test-all.R’ [15s/23s]
Running the tests in ‘tests/test-all.R’ failed.
Complete output:
  > library(testthat)
  > test_check("grainscape")
  Loading required package: grainscape
   ----------- 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(goc, whichThresh = 2, coordNoneNA)
  where 3: corridor(goc, whichThresh = 2, coordNoneNA)
  where 4: eval_bare(quo_get_expr(.quo), quo_get_env(.quo))
  where 5: withCallingHandlers(code, warning = function(condition) {
      out$push(condition)
      maybe_restart("muffleWarning")
  })
  where 6: .capture(act$val <- eval_bare(quo_get_expr(.quo), quo_get_env(.quo)), 
      ...)
  where 7: quasi_capture(enquo(object), label, capture_warnings)
  where 8 at testthat/test-corridor-distance-point.R#30: expect_warning(corridorNoneNA <- corridor(goc, whichThresh = 2, 
      coordNoneNA), NA)
  where 9: eval(code, test_env)
  where 10: eval(code, test_env)
  where 11: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 12: doTryCatch(return(expr), name, parentenv, handler)
  where 13: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 14: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 15: doTryCatch(return(expr), name, parentenv, handler)
  where 16: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 17: tryCatchList(expr, classes, parentenv, handlers)
  where 18: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 19: test_code(desc, code, env = parent.frame())
  where 20 at testthat/test-corridor-distance-point.R#15: test_that("corridor handles NA values", {
      cost <- .makeRaster(100, 5)
      mpg <- MPG(cost, cost == 1)
      goc <- GOC(mpg, nThresh = 5)
      coordNoneNA <- rbind(c(10, 10), c(90, 90))
      coordSomeNA <- rbind(c(2, 2), c(90, 90))
      coordAllNA <- rbind(c(2, 2), c(98, 98))
      expect_warning(corridorNoneNA <- corridor(goc, whichThresh = 2, 
          coordNoneNA), NA)
      expect_warning(corridorSomeNA <- corridor(goc, whichThresh = 2, 
          coordSomeNA))
      expect_error(corridorAllNA <- corridor(goc, whichThresh = 2, 
          coordAllNA))
  })
  where 21: eval(code, test_env)
  where 22: eval(code, test_env)
  where 23: withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error)
  where 24: doTryCatch(return(expr), name, parentenv, handler)
  where 25: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 26: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 27: doTryCatch(return(expr), name, parentenv, handler)
  where 28: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 29: tryCatchList(expr, classes, parentenv, handlers)
  where 30: tryCatch(withCallingHandlers({
      eval(code, test_env)
      if (!handled && !is.null(test)) {
          skip_empty()
      }
  }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, 
      message = handle_message, error = handle_error), error = handle_fatal, 
      skip = function(e) {
      })
  where 31: test_code(NULL, exprs, env)
  where 32: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 33: force(code)
  where 34: doWithOneRestart(return(expr), restart)
  where 35: withOneRestart(expr, restarts[[1L]])
  where 36: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 37: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, 
      {
          reporter$start_file(basename(path))
          lister$start_file(basename(path))
          source_file(path, new.env(parent = env), chdir = TRUE, 
              wrap = wrap)
          reporter$.end_context()
          reporter$end_file()
      })
  where 38: FUN(X[[i]], ...)
  where 39: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 40: force(code)
  where 41: doWithOneRestart(return(expr), restart)
  where 42: withOneRestart(expr, restarts[[1L]])
  where 43: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 44: with_reporter(reporter = current_reporter, results <- lapply(paths, 
      test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, 
      load_helpers = FALSE, wrap = wrap))
  where 45: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 46: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, 
      ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, 
      wrap = wrap)
  where 47: test_package_dir(package = package, test_path = test_path, filter = filter, 
      reporter = reporter, ..., stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 48: test_check("grainscape")
  
   --- 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