I tried to analyze my data using NMDS in R. My matrix has species names listed down the rows and the columns listed as individual sites. I have zeros under some sites. I am comparing the species abundance at the various sites. It only allows me to use the following code if I remove the species titles on the rows.
The code I am trying to use is this code:
BirdMatrix<-read.csv("BirdMatrix.csv")
install.packages("vegan")
library(vegan)
community_matrix<-as.matrix(BirdMatrix, ncol=8, nrow=62)
example_NMDS=monoMDS(community_matrix, # Our community-by-species matrix
k=2) # The number of reduced dimensions
But I continuously get an error:
Error in monoMDS(community_matrix, k = 10):
'dist' must be a distance object (class "dist") or a symmetric square matrix
Do I have to change the matrix somehow?
Probably you already figured it out, you need to use the
vegdist
function in the vegan package. for example:dist.bird <- vegdist( Birdmatrix, method ="bray")