Learn R Programming

funrar (version 1.5.0)

make_relative: 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)

Value

Similar shaped matrix as the input but with relative abundances instead

Arguments

abund_matrix

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

Examples

Run this code
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

Run the code above in your browser using DataLab