Summary functions that return a scalar when passed with a portion of raster. Typically passed to MHM.
Usage
richness(x, ...)
simpson(x, ...)
shannon(x, ...)
shannon_evenness(x, ...)
contagion(x, ...)
contagion_cppr(x, ...)
shannon_evenness_cppr(x, ...)
simpson_cppr(x, ...)
shannon_cppr(x, ...)Arguments
- x
a fraction of a
SpatRasterraster- ...
additional parameters, used to collect terra::focal own passing through
...
Details
For now on, some function have a cpp counterpart. The R implementation
will likely be removed soon. So far we maintain both for the sake of testing.
When a _cppr version exists, use it!
richnesssimply returns the total number of unique classes (only makes sense on categorical landscapes)simpson/simpson_cppris the Simpson's diversity indexshannon/shannon_cppris the Shannon's diversity indexshannon/shannon_cpproptimized version in cppshannon_evenness/shannon_evenness_cppris the Shannon's evenness indexkappa_index/kappa_index_cppris Kappa indexstudent_pis the p value from a Student's testcontagion/contagion_cppris the contagion index (Riitters, 1996) and also from MHM paper (only makes sense on categorical landscapes)
Examples
set.seed(2329) # for reproducibility
x <- sample(1:3, size=49, replace=TRUE, prob=c(0.1, 0.1, 1)) # unbalanced vector
table(x)
#> x
#> 1 2 3
#> 3 7 39
x %>% richness()
#> [1] 3
x %>% simpson()
#> [1] 0.3423574
x %>% simpson_cppr()
#> [1] 0.3423574
x %>% shannon()
#> [1] 0.6306752
x %>% shannon_cppr()
#> [1] 0.6306752
x %>% shannon_evenness()
#> [1] 0.5740653
x %>% shannon_evenness_cppr()
#> [1] 0.5740653
x %>% contagion()
#> [1] 42.00754
x %>% contagion_cppr()
#> [1] 42.00754
