rmSingletons: Detect and remove singletons

Description Usage Arguments Details Value Author(s) Examples

Description

A utility to detect and remove species represented only by singletons.

Usage

1

Arguments

sppVector

Vector of species names. (see sppVector).

exclude

Logical. Should singletons be removed? Default of TRUE.

Details

When exclude = TRUE (the default), singletons are excluded and the vector returns the index of all non-singletons in the dataset. When exclude = FALSE, the indices of the singletons are presented.

Value

Returns a numeric vector giving the indices of the selected individuals.

Author(s)

Samuel Brown <s_d_j_brown@hotmail.com>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
data(anoteropsis)
anoDist <- ape::dist.dna(anoteropsis)
anoSpp <- sapply(strsplit(dimnames(anoteropsis)[[1]], split="_"), 
    function(x) paste(x[1], x[2], sep="_"))

rmSingletons(anoSpp)
rmSingletons(anoSpp, exclude=FALSE)

data(dolomedes)
doloDist <- ape::dist.dna(dolomedes)
doloSpp <- substr(dimnames(dolomedes)[[1]], 1, 5)

rmSingletons(doloSpp)
rmSingletons(doloSpp, exclude=FALSE)

spider documentation built on May 2, 2019, 7:31 a.m.