make_relative: Relative abundance matrix from absolute abundance matrix

View source: R/make_relative.R

make_relativeR Documentation

Relative abundance matrix from absolute abundance matrix

Description

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.

Usage

make_relative(abund_matrix)

Arguments

abund_matrix

abundance matrix, with sites in rows and species in columns.

Value

Similar shaped matrix as the input but with relative abundances instead

Examples

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


funrar documentation built on Sept. 23, 2022, 5:10 p.m.