unsure how to correct this error

I keep getting this error
Error in cmdscale(dist, k = k) : NA values not allowed in 'd'
I changes my NA values to zeros so I would not get a numeric error and not sure where to go from here! This is what I am trying

install.packages()
library("vegan")
data("fishGR")
dput(head(mydata, 100))
diversity(fishGR, index = "shannon")
fishGR[fishGR == 1] <- 10
fishGR[fishGR == 2] <- 100
fishGR[fishGR == 3] <- 1000
fishmat = as.matrix(fishGR[,16:16])
goodrows = which(rowSums(fishmat)!=0)
fishmat = fishmat[goodrows,]
NMDS1=metaMDS(fishmat, distance = "bray",k=2,trymax=100)

I suspect you have done some more things that you haven't told us about. When I type

data("fishGR")

I get

Warning message:
In data("fishGR") : data set ‘fishGR’ not found

The code doesn't define myData.

And I don't see where you've changed NA values to zeros.

the fishGR is my data from an excel sheet, every number is either a 0, 1, 2, or 3. I changed it so it would show the zeros and not NA

Just as a check you might try

any(is.na(fishGR))
any(is.na(fishmat))

although likely all that will do is be reassuring that you have indeed gotten rid of all the NAs.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.