simmatrixMaker: Generates similarity matrix for RasterStack

View source: R/simmatrixMaker.R

simmatrixMakerR Documentation

Generates similarity matrix for RasterStack

Description

Legacy function that runs on raster::stack. Applies pairwise comparisons of Schoener's D-metric between each RasterLayer in a RasterStack to populate a similarity matrix.

Usage

simmatrixMaker(assignmentRasters, nClusters = FALSE, csvSavePath = FALSE)

Arguments

assignmentRasters

Input RasterStack

nClusters

Clusters to create run in parallel using 'doParallel'. Defaults to FALSE.

csvSavePath

Optional savepath to write similarity matrix to csv file. Defaults to FALSE, will not create csv.

Examples


# simmatrixMaker() is a legacy function for raster::stack input;
# for SpatRaster input use surfaceSimilarityMatrix() instead.
if (requireNamespace("raster", quietly = TRUE)) {
  myiso <- rast(isoscape, type = "xyz")
  myiso_sd <- rast(isoscape_sd, type = "xyz")
  set.seed(42)
  assignmentModels <- isotopeAssignmentModel(
    ID = LETTERS[1:5],
    isotopeValue = sample(-120:-40, 5),
    SD_indv = rep(5, 5),
    precip_raster = myiso,
    precip_SD_raster = myiso_sd
  )
  # Coerce to a RasterStack for the legacy interface.
  simmatrixMaker(raster::stack(assignmentModels))
}



isocat documentation built on July 9, 2026, 5:10 p.m.