spat.trait {divraster} | R Documentation |
Average trait calculation for raster
Description
Compute average for each trait.
Usage
spat.trait(x, trait, cores = 1, filename = "", ...)
Arguments
x |
A SpatRaster with presence-absence data (0 or 1) for a set of species. |
trait |
A 'data.frame' with species traits. Rownames must have species names that match with 'x'! |
cores |
A positive integer. If cores > 1, a 'parallel' package cluster with that many cores is created and used. |
filename |
Character. Save results if a name is provided. |
... |
Additional arguments to be passed passed down from a calling function. |
Value
SpatRaster with average traits.
Examples
library(terra)
bin1 <- terra::rast(system.file("extdata", "ref.tif",
package = "divraster"))
traits <- read.csv(system.file("extdata", "traits.csv",
package = "divraster"), row.names = 1)
spat.trait(bin1, traits)
[Package divraster version 1.0.4 Index]