calculateDistanceStart: Caculate ecological distance from first sample

Description Usage Arguments Value Examples

View source: R/calculateDistanceStart.R

Description

Caculate ecological distance from first sample

Usage

1
2
3
4
5
6
7
8
calculateDistanceStart(
  speciesData,
  metaData,
  idCol,
  idColType = NULL,
  distMethod,
  threshold = 0
)

Arguments

speciesData

dataset with species abundance, pre-transformed if desired

metaData

dataset with metadata, such as depth and age

idCol

name of column in metaData by which speciesData is ordered. Generally depth or year. Needs to be in ascending order (ie getting deeper or older), in the same order as the species data.

idColType

need to specify whether the idcol is a depth style or year style variable.

distMethod

the distance method to use. See ?vegan::vegdist for options.

threshold

keeps species only where those with a total summed abundance (not frequency) of more than or equal to the threshold. Default is zero.

Value

A dataframe with idCol and the distance for each point, including the distance from the first sample to itself.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## This example uses data from the analogue package

require(analogue)
data(abernethy)
speciesData <- abernethy[!names(abernethy) %in% c("Depth", "Age")]
metaData <- abernethy[c("Depth", "Age")]

distFirst <- calculateDistanceStart(speciesData, metaData,
idCol = "Age", distMethod = "jaccard", idColType = "year")

with(distFirst, plot(x = Age, y = dist_jaccard,
ylab = "Jaccard distance"))

orb16/baselines documentation built on Sept. 1, 2021, 9:21 a.m.