mx_rbind_all: Combine two species abundance matrices

Description Usage Arguments Details Value See Also Examples

Description

Cleanly combine two species abundance matrices by binding rows and filling zeros in empty cells.

Usage

1
mx_rbind_all(xx, yy)

Arguments

xx

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

yy

second array of species data

Details

Top rows are from first matrix xx, bottom rows are from second matrix yy. All names of original sample units and species are retained. Zeros fill empty cells.

Value

Matrix or data.frame containing all combined species and SUs.

See Also

rbind.fill from package plyr, and rbind_all from package dplyr.

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 Jan. 2, 2022, 11:24 p.m.