tests/testthat/test-cluster.R

test_that("cluster method", {
  library(habCluster)
  require(stars)
  require(sf)
  # read data
  hsi.file = system.file("extdata","wolf3_int.tif",package="habCluster")
  wolf = read_stars(hsi.file)

  clst = cluster(wolf, method = cluster_leiden, cellsize = 80000)

  # check results are right objects
  testthat::expect_s3_class(clst$boundary,"sf")
  testthat::expect_s3_class(clst$communities ,"communities")

})

Try the habCluster package in your browser

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

habCluster documentation built on May 25, 2022, 5:05 p.m.