Learn R Programming

BiodiversityR (version 2.16-1)

dist.eval: Distance Matrix Evaluation

Description

Function dist.eval provides one test of a distance matrix, and then continues with distconnected (vegan). Function prepare.bioenv converts selected variables to numeric variables and then excludes all categorical variables in preparation of applying bioenv (vegan).

Usage

dist.eval(x, dist)
prepare.bioenv(env, as.numeric = c())

Value

The function tests whether distance matrices have some desirable properties and provide warnings if this is not the case.

Arguments

x

Community data frame with sites as rows, species as columns and species abundance as cell values.

env

Environmental data frame with sites as rows and variables as columns.

dist

Method for calculating ecological distance with function vegdist: partial match to "manhattan", "euclidean", "canberra", "clark", "bray", "kulczynski", "jaccard", "gower", "morisita", "horn", "mountford", "raup", "binomial", "chao", "cao", "mahalanobis", "hellinger".

as.numeric

Vector with names of variables in the environmental data set to be converted to numeric variables.

Author

Roeland Kindt (World Agroforestry Centre)

Details

Function dist.eval provides two tests of a distance matrix:

(i) The first test checks whether any pair of sites that share some species have a larger distance than any other pair of sites that do not share any species. In case that cases are found, then a warning message is given.

(ii) The second test is the one implemented by the distconnected function (vegan). The distconnected test is only calculated for distances that calculate a value of 1 if sites share no species (i.e. not manhattan or euclidean), using the threshold of 1 as an indication that the sites do not share any species. Interpretation of analysis of distance matrices that provided these warnings should be cautious.

Function prepare.bioenv provides some simple methods of dealing with categorical variables prior to applying bioenv.

References

Kindt, R. & Coe, R. (2005) Tree diversity analysis: A manual and software for common statistical methods for ecological and biodiversity studies.

https://www.worldagroforestry.org/output/tree-diversity-analysis

Examples

Run this code
library(vegan)
data(dune)
dist.eval(dune,"euclidean")
dist.eval(dune,"bray")

if (FALSE) {
data(dune.env)
dune.env2 <- dune.env[,c('A1', 'Moisture', 'Manure')]
dune.env2$Moisture <- as.numeric(dune.env2$Moisture)
dune.env2$Manure <- as.numeric(dune.env2$Manure)
sol <- bioenv(dune ~ A1 + Moisture + Manure, dune.env2)
sol
summary(sol)
dune.env3 <- prepare.bioenv(dune.env, as.numeric=c('Moisture', 'Manure'))
bioenv(dune, dune.env3)
}


Run the code above in your browser using DataLab