Learn R Programming

simba (version 0.3-4)

dist.tmp: Calculate the distance between the instances or variables of two similar data-sets.

Description

The function calculates the distance between the instances or variables of two data-sets, preferably two recordings from the same places/variables at different time steps. Could for example be useful to calculate the dissimilarity of species records from the same set of plots at different recording campaigns.

Usage

dist.tmp(x, y, method = "euclidean", margin = 1, adjust=TRUE)

Arguments

x
data.frame with numeric columns giving the data at time one
y
data.frame with numeric columns giving the data at time two
method
Which distance measure should be employed? The following measurees are available: "manhattan", "euclidean", "bray", "canberra", "kulczynski", "gower", "jaccard"
margin
Shall the distance between the instances (rows, margin = 2), or the distance between the variables (columns, margin = 1) be calculated?
adjust
The default adjust = TRUE takes care of your input data. However, instances and variable names have to be unique, as the matching relies on these names. If your data meets this requirement the function automatically detects which instances an

Value

  • Returns a vector of distances. Length depends on margin. If you choose margin = 1 it equals the number of instances (plots) in your two data-sets. If you choose margin = 2 it equals the number of variables (species) in your data-sets.

encoding

UTF-8

Details

The function provides just an alternative to code your repeated measurements from the same plots, calculate the distances between all instcances and sort out the distances between the same instances at different time steps. Here just the latter is calculated directly. For details regarding the different distance coefficients, see vegdist. The formulae behind were taken from there. However, not all choices have been implemented here.

References

See references in vegdist

See Also

vegdist, dist, sim

Examples

Run this code
data(abis)

##just to see that the function takes care of matching instances 
##and variables we compare abis.spec with a permuted version of
##itself and skip some instances and variables in the original matrix.
dist.tmp(abis.spec[5:50,3:120], apply(abis.spec, 2, sample), method="bray")

Run the code above in your browser using DataLab