mx_valid: Test matrix validity

Description Usage Arguments Details Value Examples

Description

Affirm whether a species abundance matrix is valid (no NAs, no zero-sum rows, no zero-sum columns, all data 'connected').

Usage

1
mx_valid(x, checkconnect = FALSE, ...)

Arguments

x

array of species data, where rows = SUs and cols = species

checkconnect

logical, check whether data are connected, using distconnected? Default FALSE saves time and memory.

...

further arguments passed to other methods

Details

Often useful before further analysis such as calculating certain dissimilarity measures or during rejection sampling of simulated data. Data are strictly 'connected' when all sample units share the same species pool (no disconnected species pools), checked using distconnected and Bray-Curtis dissimilarities.

Value

Logical value, TRUE == valid, FALSE == not valid.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# species abundance data
set.seed(1917)
spe <- data.frame(matrix(rnorm(30, 10, 50), 10, 3))
spe[spe < 0] <- 0
colnames(spe) <- c('Acer rubrum','Acer saccharum','Acer negundo')
spe
mx_valid(spe) # expect TRUE
spe[,2] <- 0
spe[4,] <- 0
mx_valid(spe) # expect FALSE

phytomosaic/ecole documentation built on May 6, 2019, 3:45 p.m.