Skip to contents

quantify_raster() calculates various diversity indices from raster layers. table_raster() counts the occurrences.

Usage

quantify_raster(ras, MARGIN = 3L)

table_raster(ras, ..., use.names = FALSE)

Arguments

ras

A stars object.

MARGIN

A vector giving the subscripts that the function is applied over. See apply(). Relevant only when ras has more than 2 dimensions.

...

Additional arguments passed to tabulate() or table().

use.names

A logical. If TRUE, the levels in the input are preserved as names of the output.

Value

quantify_raster() returns a list of data.frames with the same length as the input raster.

table_raster() returns a list of integer vectors.

Examples

ras = raster_kgc()
quantify_raster(ras)
#> $`KG_1986-2010.grd`
#>   abundance richness idx_shannon idx_simpson idx_brillouin
#> 1   9331200       32    1.526108   0.4452376      1.526088
#> 

table_raster(ras, use.names = TRUE)
#> $`KG_1986-2010.grd`
#>      Af      Am      As      Aw     BSh     BSk     BWh     BWk     Cfa     Cfb 
#>   85453   60843    8988  211067  122450  122017  271961   77759  103870   79771 
#>     Cfc     Csa     Csb     Csc     Cwa     Cwb     Cwc     Dfa     Dfb     Dfc 
#>    7642   34680   22706     527   52994   21312     582   22800  166976  362990 
#>     Dfd     Dsa     Dsb     Dsc     Dsd     Dwa     Dwb     Dwc     Dwd      EF 
#>   31636    1816    7661   31879    6966    9324   22304   47793    5709  963667 
#>      ET   Ocean 
#>  247492 6117565 
#>