Learn R Programming

prior3D (version 0.1.5)

terra_jaccard: Jaccard similarity coefficient among two SpatRaster objects

Description

Jaccard coefficient among two SpatRaster objects

Usage

terra_jaccard(x, y)

Value

A numeric value \([0,1]\).

Arguments

x

SpatRaster object with binary values.

y

SpatRaster object with binary values.

Details

Jaccard similarity coefficient evaluates the percentage number equal to the intersection between two sets, divided by the size of the union of these sets.

Examples

Run this code
set.seed(42)
x <- terra::rast(matrix(rbinom(100, 1, 0.2), nrow=10))
y <- terra::rast(matrix(rbinom(100, 1, 0.8), nrow=10))
terra_jaccard(x, y)

Run the code above in your browser using DataLab