replace data label with number - nMDS (cluster analyses)

Hello everyone,

I am doing an nMDS (specific distribution against different stations)

I realized the nMDS but it is not very readable. I would like to be able to replace my species and station names with numbers (more readable in the nMDS) and display the correspondence in a legend that I can display in the nMDS.

Anyone have an idea how to do it?
Here an example of a dataset and the nMDS code

set.seed(2)
community_matrix=matrix(
  sample(1:100,300,replace=T),nrow=10,
  dimnames=list(paste("community",1:10,sep=""),paste("sp",1:30,sep="")))

example_NMDS=metaMDS(community_matrix,k=2,trymax=100)

colors=c(rep("red",5),rep("blue",5))
ordiplot(example_NMDS,type="n")

#Plot convex hulls with colors baesd on treatment
for(i in unique(treat)) {
  ordihull(example_NMDS$point[grep(i,treat),],draw="polygon",
           groups=treat[treat==i],col=colors[grep(i,treat)],label=F) } 
orditorp(example_NMDS,display="species",col="red",air=0.01)
orditorp(example_NMDS,display="sites",col=c(rep("green",5),
                                            rep("blue",5)),air=0.01,cex=1.25)

Thanks
Hersh

I think the path of least resistance is altering the names on community_matrix, or a copy of that. like

community_matrix2 <-community_matrix
row.names(community_matrix2) <- readr::parse_number(row.names(community_matrix2))
colnames(community_matrix2) <- readr::parse_number(colnames(community_matrix2))

Thanks for you response !
So you would integrate this code just after create the dataset ?
I try but it doesn't change anything.. :confused:

Did you change this to use community_matrix2 ?

Indeed I didn't.. :slight_smile:

Thank you very much it was I wanted
By any chance, do you know how to plot the legend with the correspondence about the number and the community ?

This topic was automatically closed 7 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.