make_obj_for_traitenv: Utility function make_obj_for_traitenv

View source: R/make_obj_for_traitenv.r

make_obj_for_traitenvR Documentation

Utility function make_obj_for_traitenv

Description

make_obj_for_traitenv combines the three data items needed for analyzing trait-environment association into a single object of class TE_obj. In the process, empty sites and non-occurring species are deleted. There is an option for stronger deleting criteria.

Usage

make_obj_for_traitenv(E, L, T, cutoff = 0)

Arguments

E

a numeric n-vector or n by p matrix containing p environmental variable(s) of n sites

L

a n by m matrix or data frame of abundance values of m species in n sites

T

a numeric m-vector or m by q matrix containing q traits of m species

cutoff

minimal number of occurrences of species

Details

If E or T is a matrix, the column names are retained. If E or T is a vector, E gets name "env" and T gets name "trait". If you wish to retain the original name, enter E and T as data frames or single column matrices with a column name.

Value

A named list,

L

a sites by species matrix of abundances, after removal of species and sites, based on cutoff

E

a matrix of environmental values (rows are the same sites as the rows of L)

T

a matrix of trait values (rows are the same as the column of L)

References

ter Braak (2019) New robust weighted averaging- and model-based methods for assessing trait-environment relationships. Methods in Ecology and Evolution (https://doi.org/10.1111/2041-210X.13278)

See Also

expand4glmm and WA_p_max.

Examples

## Not run: 
data("aravo",  package = "ade4")
Y <-aravo$spe
trait <- scale(aravo$traits$SLA)
env <- scale(aravo$env$Snow)
obj <- make_obj_for_traitenv(env,Y, trait, cutoff=0)
str(obj)

## End(Not run)

CajoterBraak/TraitEnvMLMWA documentation built on Jan. 25, 2023, 7:36 p.m.