Skip to content

Accessing NMDS points in metaMDS class object, with associated site names! #617

Answered by jarioksa
gabrieltedone asked this question in Q&A
Discussion options

You must be logged in to vote

The scores (points) will have row names if your data had row names:

> library(vegan)
> data(varespec)
> rownames(varespec)
 [1] "18" "15" "24" "27" "23" "19" "22" "16" "28" "13" "14" "20" "25" "7"  "5" 
[16] "6"  "3"  "4"  "2"  "9"  "12" "10" "11" "21"
> rownames(metaMDS(varespec, trace=FALSE)$points)
 [1] "18" "15" "24" "27" "23" "19" "22" "16" "28" "13" "14" "20" "25" "7"  "5" 
[16] "6"  "3"  "4"  "2"  "9"  "12" "10" "11" "21"
> rownames(scores(metaMDS(varespec, trace=FALSE), "sites"))
 [1] "18" "15" "24" "27" "23" "19" "22" "16" "28" "13" "14" "20" "25" "7"  "5" 
[16] "6"  "3"  "4"  "2"  "9"  "12" "10" "11" "21"

I guess you didn't have row names in your data.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@gabrieltedone
Comment options

Answer selected by gabrieltedone
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #616 on January 29, 2024 09:43.