Learn R Programming

paleoMAS (version 2.0-1)

filter.p: Filter for Presence and Persistence

Description

This function reduces a given dataset based on filters for minimum presence (abundance) AND minimum persistence (number of samples), or maximum persitence.

Usage

filter.p(x, rare=TRUE, presen = 1, persist = 0.05)

Arguments

x
Matrix or dataframe with taxa in columns and samples in rows.
rare
Argument indicating if filter aims rare or common taxa. If rare=TRUE, the filter eliminates rare taxa with presence and persitence indicated in the respective arguments. If rare=FALSE, the filter eliminates taxa with a persistence higher than that indicated in teh argument persist.
presen
Criterion for minimum percentual presence, 1 percent by default. Only relevant if rare=TRUE.
persist
Criterion for minimum persistence as a fraction of the number of samples where the taxon is expected to occur, 0.05 of the total number of samples by default.

Value

Returns a list with three components
filtered
Reduced dataset after both filters are applied.
filter
This component is returned only when rare=TRUE. Matrix with three columns: n, number of samples where taxon is present; n over minimum presence, number of samples where percentage is greater than the defined minimum or filter; quality, binary that lets the user know whether or not a taxon meets the filter criteria.
result
List with two or three components: percentage, minimum presence, only relevant when rare=TRUE; minimum or maximum, minimum or maximum persistence; and number of taxa, total number of taxa that meet the filter criteria.

Details

This function applies both the presence and persistence filters when rare=TRUE. If the user desires to apply only one of the filters at a given time, a criterion that is met by all elements (taxa) should be chosen, e.g. persist=0. If rare=FALSE, only the criterion of being under the given persitence threshold is applied.

References

Correa-Metrio, A., K.R. Cabrera, and M.B. Bush. 2010. Quantifying ecological change through discriminant analysis: a paleoecological example from the Peruvian Amazon. Journal of Vegetation Science 21: 695-704.

Examples

Run this code
#For a minimum presence of 2 percent in 20 percent of the samples
data(quexilper)
filter.p(quexilper)
quexilfil<-filter.p(quexilper,presen=2,persist=0.2)
#Filtered database
quexilfil$filtered

Run the code above in your browser using DataLab