jaccard | R Documentation |
Estimates the Jaccard index for comparing two binary maps
jaccard(m1, m2)
m1 |
A binary raster A or an object of class setA returned by the function |
m2 |
A binary raster A or an object of class setA returned by the function |
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|}}.
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
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.