Error in cmdscale(dist, k = k) : NA values not allowed in 'd'

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)

Hello.
Thanks for providing code , but you could take further steps to make it more convenient for other forum users to help you.

Share some representative data that will enable your code to run and show the problematic behaviour.

You might use tools such as the library datapasta, or the base function dput() to share a portion of data in code form, i.e. that can be copied from forum and pasted to R session.

Reprex Guide

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.