vardist {labdsv} | R Documentation |
Calculates a matrix of pair-wise differences between value for a particular numeric variable for a dataset.
vardist(x)
x |
a vector of numeric values |
Calculates the absolute value of the difference between all possible values in a vector, producing a matrix of differences with as many rows and columns as the length of the vector
an object of class dist
This function can be used to compare the compositional differences among samples to the environmental differences by correlation or regression, or perhaps other routines.
David W. Roberts droberts@montana.edu http://ecology.msu.montana.edu/labdsv
http://ecology.montana.msu.edu/labdsv/
data(bryceveg) # returns a vegetation data.frame called bryceveg data(brycesite) # returns an environmental data.frame called brycesite dis.bc <- dsvdis(bryceveg,'bray/curtis') # returns a Bray/Curtis dissimilarity matrix dis.elev <- vardist(brycesite$elev) # matrix of pair-wide differences in elevation cor(as.vector(dis.bc),as.vector(dis.elev))