tests/testthat/helper_sf.R

#' Is single patch?
#'
#' Check if all geometries form a single patch?
#'
#' @param x [sf::st_sf()] object.
#'
#' @param call Caller environment.
#'
#' @return A `logical` value.
#'
#' @noRd
is_single_patch_sf <- function(x) {
  assert(inherits(x, "sf"), .internal = TRUE)
  m <- igraph::graph_from_adjacency_matrix(adjacency_matrix(x))
  isTRUE(igraph::components(m)$no == 1)
}

Try the prioritizr package in your browser

Any scripts or data that you put into this service are public.

prioritizr documentation built on Aug. 9, 2023, 1:06 a.m.