Участок NMDS с использованием видов - PullRequest
0 голосов
/ 20 мая 2019

Я использую данные о видовом покрове и данные об окружающей среде для построения НМДС на 2D и 3D-графике с использованием пакета VEGAN. Я могу строить НМДС на основе участков, но при попытке нанести на карту с помощью NMDS

" species scores not available
Error in order(x) : argument 1 is not a vector"

ошибкавсплывает.Я также пытался использовать warscores=T, но проблема существует.У меня есть следующие типы данных: Вид данных.Я также пытался сгруппировать данные по обработке, используя ordihull, но он также не будет рисовать многоугольник.

Я могу создать богатство видов, даже я могу построить NMDS, но без оценок видов.ниже приведены данные о видах

Row Labels  Acalypha gracilens  Acalypha virginica  Acer rubrum Acer saccharum  Adiantum pedatum    Ageratina altissima Agrimonia rostellata    Amelanchier arborea Amphicarpa bracteata    Anemone virginiana  Antennaria parlinii Antenoron virginiana    Aralia spinosa  Arisaema dracontium Arisaema triphyllum Asimina triloba Asplenium platyneuron   Athyrium filix-femina   Botrypus virginianus
2014PL1 0   0   0   3.5 0   0   0   0   15.5    0   0   0   0   0   0   0   0   0   0
2014PL10    0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
2014PL11    0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
2014PL12    0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
2014PL13    0   0   0   0   0   0   0   0   3.5 0   0   0   0   0   0   0   0   0   0
2014PL14    0   0   0   0.5 0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
2014PL15    0   0   0   0   0   0   0   0   15.5    0   0   0   0   0   0   0   0   0   0
2014PL16    0   0   0   0.5 0   0   0   0   0.5 0   0   0   0   0   0   0   0   0   0
2014PL17    0   0   0   15.5    0   0   0   0   0.5 0   0   0   0   0   0   0   0   0   0
2014PL18    0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
2014PL19    0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   3.5 0   0   0
2014PL2 0   0   0   3.5 0   0   0   0.5 3.5 0   0   0   0   0   0   0   0   0   0
2014PL20    0   0   0   3.5 0   0   0   0   0   0   0   0   0   0   0   63  0   15.5    0

И данные об окружающей среде выглядят как

    Treatment   elevation   slope_per   AspectDir   PPT TMEAN   TMIN    TMAX    sprichness  shanentrop  invsimpson
2014PL1 Burn First  181 56  North   1070    13  7   18  6   4.00621539  3.2647854
2014PL10    Thin First  170 21  Southwest   1070    13  7   18  11  3.596290814 3.212736502
2014PL11    Burn First  181 11  North   1070    13  7   18  5   2.733395222 2.081998115
2014PL12    Control West    159 14  Southwest   1070    13  7   18  3   1.919417872 1.592798768
2014PL13    Control West    168 16  South   1070    13  7   18  17  7.633877547 6.004748813
2014PL14    Control East    168 26  Northeast   1070    13  7   18  11  4.062814017 2.995957554
2014PL15    Control East    180 8   Northeast   1070    13  7   18  13  6.689341767 5.228200972
2014PL16    Burn First  170 46  Southwest   1070    13  7   18  9   2.711557879 1.755060729
2014PL17    Thin First  176 26  South   1070    13  7   18  7   2.621677069 2.050662739

Код:

## Import species data and environmental data##
comm <- read.table("species.csv",header=TRUE, row.names=1, sep=",")
singleton_Comm<- comm[,colSums(comm>0)>1, drop=F]
#comm_wis_trans<-wisconsin(singleton_Comm)
dm_matrix<-vegdist(singleton_Comm)
#Generate stress values for 1-4 dimensional NMDS and make scree plot
ord1d<-metaMDS(dm_matrix, distance = "bray", k = 1,wascores=TRUE, trymax = 100)
#print(ord1d$stress)
ord2d <- metaMDS(dm_matrix, distance = "bray", k = 2,wascores=TRUE, trymax = 100)
#print(ord2d$stress)
ord3d <- metaMDS(dm_matrix, distance = "bray", k = 3,wascores=TRUE, trymax = 100)
#print(ord3d$stress)
ord4d <- metaMDS(dm_matrix, distance = "bray", k = 4,wascores=TRUE, trymax = 100)
#print(ord4d$stress)
#stress<-c(ord1d$stress, ord2d$stress, ord3d$stress, ord4d$stress)
#plot(stress, xlab = "Number of Dimensions", ylab = "Stress")

stress<-c(ord1d$stress, ord2d$stress, ord3d$stress, ord4d$stress)
##Plotting stress of different ordination##
par(mfrow=c(2,2))
stressplot(ord1d)
stressplot(ord2d)
stressplot(ord3d)
plot(stress, xlab = "Number of Dimensions", ylab = "Stress")


##Importing the Environment Variables##
environment <- read.table("environment.csv",header=TRUE, row.names=1, sep=",")
env<-data.frame(environemnt[1:11])

##Vector fitting environment variables and richness index with 3rd ordination because only 3rd ord has less than0.2 stress##
vectors1 <- envfit(ord2d, env, na.rm = TRUE, permu = 999, choices = 1:2)
vectors <- envfit(ord3d, env, na.rm = TRUE, permu = 999, choices = 1:3)

#Plotting NMDS using 2D species score and sites
ordiplot(ord2d, choices = c(1, 2), type="points", display = "sites", xlim = c(-0.5,0.7), ylim = c(-0.5,0.5),
         cex = 0.7)
ordiplot(ord2d, choices = c(1, 2), type="points", display = "species", xlim = c(-0.5,0.7), ylim = c(-0.5,0.5),
         cex = 0.7)

#fitting ordihull
ordihull(ord2d,groups=env$Treatment,draw="polygon",col="red",label=T)

#Plotting using 3D
ord3dplotyear <- ordirgl(ord3d, display = "sites", choices = 1:3, col = c(rep("red"), rep("orange"), rep("yellow"), rep("green")))

ord3dplotyear <- ordirgl(ord3d, display = "species", choices = 1:3, col = c(rep("red"), rep("orange"), rep("yellow"), rep("green")))


ordihull(ord2d,groups=treatment,draw="polygon",col="red",label=T)

Я ожидаю участок NMDS, показывающий оценки видов и обработку, баллы видов и высота и т. д.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...