View source: R/lets_maplizer_env.R
| lets.maplizer.env | R Documentation |
Summarize species-level attributes (e.g., traits or conservation data) within each cell of environmental and geographic presence–absence matrices, enabling trait-based mapping across environmental gradients and geographic space.
lets.maplizer.env(x, y, z, func = mean, ras = TRUE, weighted = FALSE)
x |
An object produced by |
y |
A numeric vector containing the species attributes to be summarized (e.g., description year, body size). |
z |
A character vector with species names corresponding to the values in |
func |
A function used to summarize the attribute across species in each cell (e.g., |
ras |
Logical. If |
weighted |
If TRUE, argument func is ignored, and weighted mean is calculated. Weights are attributed to each species according to 1/N cells that the species occur. |
This function is useful for trait-based macroecological analyses that aim to
understand how species attributes vary across environments or space. It uses
the output of lets.envpam, applies a summary function to the
trait values of all species present in each cell, and returns raster layers
for visualization.
A list with the following elements:
Matrix_env: A matrix with summarized attribute values in environmental space.
Matrix_geo: A matrix with summarized attribute values in geographic space.
Env_Raster: A SpatRaster with the attribute values mapped in environmental space.
Geo_Raster: A SpatRaster with the attribute values mapped in geographic space.
Bruno Vilela
lets.envpam, lets.maplizer, lets.plot.envpam
## Not run:
# Load data
data("Phyllomedusa")
data("prec")
data("temp")
data("IUCN")
prec <- unwrap(prec)
temp <- unwrap(temp)
PAM <- lets.presab(Phyllomedusa, remove.cells = FALSE)
envs <- lets.addvar(PAM, c(temp, prec), onlyvar = TRUE)
colnames(envs) <- c("Temperature", "Precipitation")
wrld_simpl <- get(utils::data("wrld_simpl", package = "letsR"))
PAM <- lets.pamcrop(PAM, vect(wrld_simpl))
# Create environmental PAM
res <- lets.envpam(PAM, envs, remove.cells = FALSE)
# Map mean description year
res_map <- lets.maplizer.env(res,
y = IUCN$Description_Year,
z = IUCN$Species)
# Plotting trait maps
lets.plot.envpam(res_map)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.