Description Usage Arguments Details Value Author(s) Examples
This function takes a community matrix and remove all those species that have less than a specified number of presences in the dataset. It also provide an option to remove high prevalent species or both.
1 | removeAbsentSpecies(commMatrix, n, applyTo = c("low", "high", "both"))
|
commMatrix |
Matrix. Community matrix (species by sites) to be reduced. |
n |
Numeric. This value indicate the minimum number of presences for a species to be kept in the output community matrix. |
applyTo |
String. This argument specify whether the function will apply as minimum number of presences (remove low prevalent species with less presences than n) or as minimum number of absences (remove high prevalent species with less absences than n) or as minimum number of both presences and absences (remove high and low prevalent species). |
The function use the function "greater than" and not "greater or equal than" so, to get species with 20 presences you should specify the value 19 in the argument n.
Matrix. Community matrix with less species than the input but with the same number of sites.
Diego Nieto Lugilde
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (commMatrix, n, applyTo = c("low", "high", "both"))
{
pL <- commMatrix > 0
lowPrev <- which(colSums(pL) >= n)
highPrev <- which(colSums(!pL) >= n)
if (applyTo == "low")
staySpec <- lowPrev
if (applyTo == "high")
staySpec <- highPrev
if (applyTo == "both")
staySpec <- intersect(lowPrev, highPrev)
pN <- commMatrix[, staySpec]
return(pN)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.