View source: R/complementarity.R
complementarity | R Documentation |
Compare raster values within and outside of a mask
complementarity(ras1, ras1mask)
ras1 |
'raster' object of categorical values (e.g., a species richness map) |
ras1mask |
'raster' object representing areas of interest (e.g., protected areas) |
A list of two objects. The first is the proportion of the range within the mask, and the second is the proportion of unique values masked.
# create raster
ras1 <- raster::raster(nrows=108, ncols=108, xmn=-50, xmx=50)
raster::values(ras1)<- runif(n = (108*108))
ras1[ras1 < 0.5] <- NA
ras1[!is.na(ras1)] <- 1
# create ras1mask
ras1mask <- raster::raster(nrows=108, ncols=108, xmn=-50, xmx=50)
raster::values(ras1mask)<- runif(n = (108*108))
ras1mask[ras1mask < 0.15] <- NA
ras1mask[!is.na(ras1mask)] <- 1
# complementarity
complementarity(ras1, ras1mask)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.