I am trying to retrieve the coordinates for each species in my NMDS using the fortify
function, but receive:
Error:
data
must be a data frame, or other object coercible byfortify()
, not an S3 object with class metaMDS/monoMDS.
I have tried converting the NMDS output to a dataframe but this did not work. My sample data and my code are below:
spp1 <- c(5, 0, 3, 1, 2)
spp2 <- c(0, 12, 1, 8, 1)
spp3 <- c(0, 0, 0, 0, 1)
bank.plot.nmds <- data.frame(spp1, spp2, spp3)
Each column represents a species and each row represents a single plot. The NMDS won't converge but with this limited dataset but it should still work for the question.
library(vegan)
nmds1 <- metaMDS(bank.plot.nmds, trymax = 200, k = 3)
fortify(nmds1)
I thought fortify
would provide a table with each species' coordinates? Perhaps there is a better way to extract these values?
Install my {ggvegan} package from GitHub, which provides a fortify()
method for these objects.