View source: R/lets_subsetPAMenv.R
| lets.subsetPAMenv | R Documentation |
Subsets an environmental-space presence-absence matrix (PAM) generated by
lets.envpam by retaining only a selected set of species.
Species not included in species are removed from both tabular
components of the object, and species richness is recalculated and written
back to the corresponding raster layers.
lets.subsetPAMenv(x, species, remove.cells = TRUE)
x |
An environmental PAM produced by |
species |
A character vector with species names to retain in the PAM. |
remove.cells |
Logical. If |
Optionally, cells with zero richness after subsetting can be removed from the tabular components.
If none of the supplied species names match the species present in the PAM, the function stops with an error before modifying the object.
A list with the same structure as the input object:
x[[1]]: the subsetted env PAM table.
x[[2]]: the subsetted geo PAM table.
x[[3]]: the raster associated with env PAM, updated with
recalculated richness values.
x[[4]]: the raster associated with geo PAM, updated with
recalculated richness values.
lets.envpam, lets.plot.envpam,
lets.presab, lets.addvar
## Not run:
data("Phyllomedusa")
data("prec")
data("temp")
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))
res <- lets.envpam(PAM, envs)
lets.plot.envpam(
x = res,
species = NULL,
cell_id_env = NULL,
cell_id_geo = NULL,
plot.grid = TRUE,
world = TRUE,
mar = c(4, 4, 4, 4)
)
sub <- sample(PAM$Species_name, 10)
pam_sub <- lets.subsetPAMenv(res, sub)
lets.plot.envpam(pam_sub)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.