chooseTaxa: Select taxa (variables) on basis of maximum abundance...

Description Usage Arguments Value Author(s) Examples

View source: R/chooseTaxa.R

Description

Select taxa (variables) from an object on the basis of one or both of maximum abundance and number of occurrences greater than user-specified values. This is a simple utility function to encapsulate this common task in filtering palaeoecological data sets.

Usage

1
2
3
4
5
6
chooseTaxa(object, ...)

## Default S3 method:
chooseTaxa(object, n.occ = 1, max.abun = 0,
           type = c("AND","OR"), value = TRUE, na.rm = FALSE,
           ...)

Arguments

object

an R object for which a suitable method exists. The default method assumes a matrix-like object such as a data frame or a numeric matrix.

n.occ

numeric; number of occurrences representing the lower limit for selection. A taxon is included in the returned subset if it is present a total of n.occ times or more. See argument type for a modifier which might exclude the taxon even if it would be included on the basis of n.occ.

max.abun

numeric; maximum abundance representing the lower limit for selection. A taxon is included in the returned subset if it attains abundance equal to or greater than max.abun in one or more sample. See argument type for a modifier which might exclude the taxon even if it would be included on the basis of max.abun.

type

character; one of "AND" or "OR", controlling how the criteria n.occ and max.abun are combined to generate a subset of the variables in object.

value

logical; should the data for the selected taxa be returned? If TRUE, the default, the data for the chosen taxa are returned. If FALSE, a logical vector is returned, indicating which taxa met the selection criteria.

na.rm

logical; should missing values NAs be excluded from the calculation of abundances and occurrence?

...

arguments passed on to subsequent methods.

Value

If value = TRUE, returns the supplied data frame or matrix with a subset of columns (taxa) that meet the criteria chosen. If value = FALSE, a logical vector is returned.

Author(s)

Gavin L. Simpson

Examples

1
2
3
4
5
6
7
data(ImbrieKipp)
IK2 <- chooseTaxa(ImbrieKipp, n.occ = 5)
dim(ImbrieKipp)
dim(IK2)

## return a logical vector to select species/columns
chooseTaxa(ImbrieKipp, n.occ = 5, value = FALSE)

Example output

Loading required package: vegan
Loading required package: permute
Loading required package: lattice
This is vegan 2.5-7
analogue version 0.17-5
[1] 61 27
[1] 61 27
 O.univ G.cglob G.ruber G.tenel G.saccu G.rubes  G.pacL  G.pacR G.bullo G.falco 
   TRUE    TRUE    TRUE    TRUE    TRUE    TRUE    TRUE    TRUE    TRUE    TRUE 
G.calid G.aequi G.gluti G.duter G.infla  G.trnL  G.trnR G.crasf G.scitu G.mentu 
   TRUE    TRUE    TRUE    TRUE    TRUE    TRUE    TRUE    TRUE    TRUE    TRUE 
P.obliq C.nitid S.dehis G.digit   Other  G.quin G.hirsu 
   TRUE    TRUE    TRUE    TRUE    TRUE    TRUE    TRUE 

analogue documentation built on June 21, 2021, 1:08 a.m.