Learn R Programming

funrar (version 1.5.0)

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

Value

TRUE if the input has relative abundances FALSE otherwise

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

See Also

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

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

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

Run the code above in your browser using DataLab