dist.zeroes: Distance Matrix Transformation

Description Usage Arguments Details Value Author(s) References Examples

Description

Sample units without any species result in "NaN" values in the distance matrix for some of the methods of vegdist (vegan). The function replaces "NA" by "0" if both sample units do not contain any species and "NA" by "1" if only one sample unit does not have any species.

Usage

1

Arguments

comm

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

dist

Distance matrix as calculated with function vegdist.

Details

This functions changes a distance matrix by replacing "NaN" values by "0" if both sample units do not contain any species and by "1" if only one sample unit does not contain any species.

Please note that there is a valid reason (deliberate removal of zero abundance values from calculations) that the original distance matrix contains "NaN", so you may not wish to do this transformation and remove sample units with zero abundances from further analysis.

Value

The function provides a new distance matrix where "NaN" values have been replaced by "0" or "1".

Author(s)

Roeland Kindt (World Agroforestry Centre)

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

1
2
3
4
5
6
7
8
library(vegan)
matrix <- array(0,dim=c(5,3))
matrix[4,] <- c(1,2,3)
matrix[5,] <- c(1,0,0)
dist1 <- vegdist(matrix,method="kulc")
dist1
dist2 <- dist.zeroes(matrix,dist1)
dist2

Example output

Loading required package: tcltk
Loading required package: vegan
Loading required package: permute
Loading required package: lattice
This is vegan 2.5-4
BiodiversityR 2.11-1: Use command BiodiversityRGUI() to launch the Graphical User Interface; 
to see changes use BiodiversityRGUI(changeLog=TRUE, backward.compatibility.messages=TRUE)

Warning message:
no DISPLAY variable so Tk is not available 
Warning messages:
1: In vegdist(matrix, method = "kulc") :
  you have empty rows: their dissimilarities may be meaningless in method "kulczynski"
2: In vegdist(matrix, method = "kulc") : missing values in results
          1         2         3         4
2       NaN                              
3       NaN       NaN                    
4       NaN       NaN       NaN          
5       NaN       NaN       NaN 0.4166667
          1         2         3         4
2 0.0000000                              
3 0.0000000 0.0000000                    
4 1.0000000 1.0000000 1.0000000          
5 1.0000000 1.0000000 1.0000000 0.4166667

BiodiversityR documentation built on April 20, 2021, 5:07 p.m.