Running ‘testthat.R’ [6s/9s]
Running the tests in ‘tests/testthat.R’ failed.
Complete output:
  > library(testthat)
  > test_check("ipdw")
  Loading required package: ipdw
  Loading required package: gdistance
  Loading required package: raster
  Loading required package: sp
  Loading required package: igraph
  
  Attaching package: 'igraph'
  
  The following object is masked from 'package:raster':
  
      union
  
  The following object is masked from 'package:testthat':
  
      compare
  
  The following objects are masked from 'package:stats':
  
      decompose, spectrum
  
  The following object is masked from 'package:base':
  
      union
  
  Loading required package: Matrix
  
  Attaching package: 'gdistance'
  
  The following object is masked from 'package:igraph':
  
      normalize
  
   ----------- FAILURE REPORT -------------- 
   --- failure: the condition has length > 1 ---
   --- srcref --- 
  : 
   --- package (from environment) --- 
  ipdw
   --- call from context --- 
  costrasterGen(xymat, pols, projstr = latlonproj)
   --- call from argument --- 
  if (class(xymat) == "SpatialPointsDataFrame" | class(xymat) == 
      "SpatialPoints") {
      xymat <- sp::coordinates(xymat)
  }
   --- R stacktrace ---
  where 1: costrasterGen(xymat, pols, projstr = latlonproj)
  where 2: eval_bare(expr, quo_get_env(quo))
  where 3: quasi_label(enquo(object), label, arg = "object")
  where 4 at testthat/test-costrasterGen.R#22: expect_is(costrasterGen(xymat, pols, projstr = latlonproj), "RasterLayer")
  where 5: eval(code, test_env)
  where 6: eval(code, test_env)
  where 7: 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 8: doTryCatch(return(expr), name, parentenv, handler)
  where 9: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 11: doTryCatch(return(expr), name, parentenv, handler)
  where 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 13: tryCatchList(expr, classes, parentenv, handlers)
  where 14: 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 15: test_code(desc, code, env = parent.frame())
  where 16 at testthat/test-costrasterGen.R#3: test_that("returns correct class and warn on bad projection", 
      {
          Sr1 <- Polygon(cbind(c(0, 0, 1, 1, 0), c(0, 12, 12, 0, 
              0)))
          Sr4 <- Polygon(cbind(c(9, 9, 10, 10, 9), c(0, 12, 12, 
              0, 0)))
          Sr2 <- Polygon(cbind(c(1, 1, 9, 9, 1), c(11, 12, 12, 
              11, 11)))
          Sr3 <- Polygon(cbind(c(1, 1, 9, 9, 1), c(0, 1, 1, 0, 
              0)))
          Sr5 <- Polygon(cbind(c(4, 4, 5, 5, 4), c(4, 8, 8, 4, 
              4)))
          Srs1 <- Polygons(list(Sr1), "s1")
          Srs2 <- Polygons(list(Sr2), "s2")
          Srs3 <- Polygons(list(Sr3), "s3")
          Srs4 <- Polygons(list(Sr4), "s4")
          Srs5 <- Polygons(list(Sr5), "s5")
          pols <- SpatialPolygons(list(Srs1, Srs2, Srs3, Srs4, 
              Srs5), 1:5)
          xymat <- matrix(3, 3, nrow = 1, ncol = 2)
          latlonproj <- "+proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0"
          sp::proj4string(pols) <- sp::CRS(latlonproj)
          expect_is(costrasterGen(xymat, pols, projstr = latlonproj), 
              "RasterLayer")
          expect_message(costrasterGen(xymat, pols, projstr = NULL), 
              "Warning, the projection of polygons does not\n    \t\t\t\tmatch projstr. See rgdal::spTransform")
      })
  where 17: eval(code, test_env)
  where 18: eval(code, test_env)
  where 19: 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 20: doTryCatch(return(expr), name, parentenv, handler)
  where 21: tryCatchOne(expr, names, parentenv, handlers[[1L]])
  where 22: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
  where 23: doTryCatch(return(expr), name, parentenv, handler)
  where 24: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), 
      names[nh], parentenv, handlers[[nh]])
  where 25: tryCatchList(expr, classes, parentenv, handlers)
  where 26: 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 27: test_code(NULL, exprs, env)
  where 28: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap)
  where 29: force(code)
  where 30: doWithOneRestart(return(expr), restart)
  where 31: withOneRestart(expr, restarts[[1L]])
  where 32: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 33: 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 34: FUN(X[[i]], ...)
  where 35: lapply(paths, test_file, env = env, reporter = current_reporter, 
      start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)
  where 36: force(code)
  where 37: doWithOneRestart(return(expr), restart)
  where 38: withOneRestart(expr, restarts[[1L]])
  where 39: withRestarts(testthat_abort_reporter = function() NULL, force(code))
  where 40: 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 41: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, 
      stop_on_warning = stop_on_warning, wrap = wrap)
  where 42: 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 43: 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 44: test_check("ipdw")
  
   --- value of length: 2 type: logical ---
  [1] FALSE FALSE
   --- function from context --- 
  function (xymat, pols, extent = "polys", projstr, resolution = 1) 
  {
      if (class(xymat) == "SpatialPointsDataFrame" | class(xymat) == 
          "SpatialPoints") {
          xymat <- sp::coordinates(xymat)
      }
      if (!identical(projstr, sp::proj4string(pols))) {
          message("Warning, the projection of polygons does not\n    \t\t\t\tmatch projstr. See rgdal::spTransform")
      }
      if (extent == "polys") {
          xmn <- min(sp::bbox(pols)[1, ])
          xmx <- max(sp::bbox(pols)[1, ])
          ymn <- min(sp::bbox(pols)[2, ])
          ymx <- max(sp::bbox(pols)[2, ])
      }
      if (extent == "points" | extent == "pnts") {
          ymn <- range(xymat[, 2])[1]
          ymx <- range(xymat[, 2])[2]
          xmn <- range(xymat[, 1])[1]
          xmx <- range(xymat[, 1])[2]
      }
      nrow <- ymx - ymn
      ncol <- xmx - xmn
      r <- raster::raster(nrow = nrow, ncol = ncol, crs = projstr, 
          xmn = xmn, xmx = xmx, ymn = ymn, ymx = ymx)
      if (resolution != 1) {
          r <- raster::raster(nrow = nrow, ncol = ncol, crs = projstr, 
              xmn = xmn, xmx = xmx, ymn = ymn, ymx = ymx, resolution = resolution)
      }
      costras <- raster::rasterize(pols, r, silent = TRUE)
      m <- c(0, +Inf, 10000)
      rclmat <- matrix(m, ncol = 3, byrow = TRUE)
      costras <- raster::reclassify(costras, rclmat)
      costras <- raster::reclassify(costras, cbind(NA, 1))
      return(costras)
  }
  <bytecode: 0x55b5bf36ea40>
  <environment: namespace:ipdw>
   --- function search by body ---
  Function costrasterGen in namespace ipdw has this body.
   ----------- END OF FAILURE REPORT -------------- 
  Fatal error: the condition has length > 1