Description Usage Arguments Details Value Examples
Collapse two matrix or data.frame columns into one, where new values are the min, max, or mean. Appropriate for synonymizing species (columns) in a species abundance matrix.
1 | mx_collapse(x, c1, c2, method = "max", ...)
|
x |
array of species data, where rows = SUs and cols = species, containing the two columns to be collapsed and synonymized |
c1 |
column name (to be retained) |
c2 |
column name (to be omitted) |
method |
method to retain values, one of 'min', 'max' or 'mean' |
... |
further arguments passed to other methods |
Appropriate for synonymizing species (columns) in a species abundance matrix. For example, if a species occurs twice in a plot, simply take the highest, lowest, or mean of observed values. The name of the first column is retained, the second column is removed.
Modified dataframe or matrix, with one fewer column than the original.
1 2 3 4 5 6 7 8 | # 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_collapse(spe, c1='Acer rubrum', c2='Acer negundo')
mx_collapse(spe, c1='Acer rubrum', c2='Acer negundo', method='mean')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.