jaccard: jaccard: Estimates the Jaccard index for comparing two binary...

View source: R/jaccard.R

jaccardR Documentation

jaccard: Estimates the Jaccard index for comparing two binary maps

Description

Estimates the Jaccard index for comparing two binary maps

Usage

jaccard(m1, m2)

Arguments

m1

A binary raster A or an object of class setA returned by the function model2sparse.

m2

A binary raster A or an object of class setA returned by the function model2sparse.

Details

The Jaccard index is computed as follows

J(A,B) = {{|A \cap B|}\over{|A \cup B|}} = {{|A \cap B|}\over{|A| + |B| - |A \cap B|}}.

Value

Returns a data.frame with three values: 1) jaccard (Jaccard index), 2) percentage_m1 (the percentage of m1 that the intersection |A \cap B| represents), and 3) percentage_m2

Examples

m1_path <- system.file("extdata/conejos/Lepus_othus_cont.tif",
                       package = "bam")
m2_path <- system.file("extdata/conejos/Brachylagus_idahoensis_cont.tif",
                       package = "bam")
m1 <- raster::raster(m1_path) > 0.01
m2 <- raster::raster(m2_path) >0.01
jcc <- bam::jaccard(m1,m2)
print(jcc)

luismurao/bam documentation built on Nov. 28, 2022, 3:02 p.m.