View source: R/make_relative.R
make_relative | R Documentation |
From an abundance matrix (numbers of individuals of a given species at a site) returns a relative abundance matrix (proportion of individuals of a given species at a given site). This function works also with sparse matrices.
make_relative(abund_matrix)
abund_matrix |
abundance matrix, with sites in rows and species in columns. |
Similar shaped matrix as the input but with relative abundances instead
data("aravo", package = "ade4") # Site-species matrix mat = as.matrix(aravo$spe) head(mat)[, 1:5] # Has absolute abundances rel_mat = make_relative(mat) head(rel_mat) # Relative abundances
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.