Learn R Programming

spider (version 1.2-0)

sppDist: Intra and inter-specific distances

Description

Separates a distance matrix into its inter- and intra-specific components.

Usage

sppDist(distobj, sppVector)

Arguments

distobj
A distance matrix.
sppVector
The species vector (see sppVector).

Value

  • A list with two elements:
  • interA numeric vector containing ALL inter-specific pairwise distances.
  • intraA numeric vector containing ALL intra-specific pairwise distances.

Details

This function can be used to produce histograms and other charts exploring the `barcode gap', such as in the examples below.

See Also

sppDistMatrix.

Examples

Run this code
data(dolomedes)
doloDist <- dist.dna(dolomedes)
doloSpp <- substr(dimnames(dolomedes)[[1]], 1, 5)

doloSpDist <- sppDist(doloDist, doloSpp)

doloSpDist

#Histogram of the barcode gap
transGreen <- rgb(0, 1, 0, 0.5) #Make a slightly transparent colour to see some overlap
hist(doloSpDist$inter, col="grey")
hist(doloSpDist$intra, col=transGreen, add=TRUE)

#Boxplot of the same
boxplot(doloSpDist)

Run the code above in your browser using DataLab