is_relative: Tell if matrix or data.frame has relative abundances

View source: R/make_relative.R

is_relativeR Documentation

Tell if matrix or data.frame has relative abundances

Description

From an abundance/presence-absence matrix or data.frame tells if it contains relative abundances or absolute abundances. Checks if all abundances are between 1 and 0 but never checks sum of abundances per community.

Usage

is_relative(given_obj, abund = NULL)

Arguments

given_obj

abundance or presence-absence matrix, with sites in rows and species in columns, or tidy community data frame

abund

name of the column of the provided object that contains the abundances

Value

TRUE if the input has relative abundances FALSE otherwise

See Also

make_relative() to transform matrix into a relative abundance matrix.

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

# Forced to use ':::' becasue function is not exported
funrar:::is_relative(mat)      # FALSE
funrar:::is_relative(rel_mat)  # TRUE


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