嗨,所以我想繪製我在r中的bray-curtis不相似矩陣中的組合數據的nmds。我已經能夠應用ordielipse() ,ordihull()和甚至改變基於由cutree()創建一個hclst的)使用來自純素包沙丘數據如何使用基於SIMPROF的彩色/符號點繪製nmds
data(dune)
Dune.dis <- vegdist(Dune, method = "bray)
Dune.mds <- metaMDS(Dune, distance = "bray", k=2)
#hierarchical cluster
clua <- hclust(Dune.dis, "average")
plot(clua, hang = -1)
# set groupings
rect.hclust(clua, 4)
grp <- cutree(clua, 4)
#plot mds
plot(Dune.mds, display = "sites", type = "text", cex = 1.5)
#show groupings
ordielipse(Dune.mds, group = grp, border =1, col ="red", lwd = 3)
甚至着色點只是由組因子(
例如顏色cutree
colvec <- c("red2", "cyan", "deeppink3", "green3")
colvec[grp]
plot(Dune.mds, display = "sites", type = "text", cex = 1.5) #or use type = "points"
points(P4.mds, col = colvec[c2], bg =colvec[c2], pch=21)
但是我真正想要做的是使用SIMPROF函數使用包「clustsig」,然後根據重要的分組對顏色點進行着色 - 這更像是一種技術編碼語言 - 我確信有一種方法可以創建因素串,但我相信有一種更有效的方式來做到這一點
繼承人到目前爲止我的代碼爲:
simp <- simprof(Dune.dis, num.expected = 1000, num.simulated = 999, method.cluster = "average", method.distance = "braycurtis", alpha = 0.05, sample.orientation = "row")
#plot dendrogram
simprof.plot(simp, plot = TRUE)
現在,我只是不知道如何做下一步繪製NMDS使用由SIMPROF定義的分組 - 我如何使SIMPROF結果成爲一個因子字符串,而不用直接輸入它我自己它自己?
在此先感謝。
非常感謝!我很輕鬆地工作 - 非常明確的迴應!我仍在編寫代碼並理解R軟件包的文檔 - 但我還有一段路要走,所以感謝您的幫助。 – Lmm