#2 summary(doubs.spe) #3 library(vegan) pca.1<-rda(decostand(doubs.spe[,-1], method="hell")) #4 pca.1 #5 screeplot(pca.1, bstick=T) abline(h=mean(eigenvals(pca.1))) #6 plot(pca.1) ordiplot(pca.1) ?ordiplot ?plot.cca #7 c(0.24913,0.06592,0.04615)/0.5023 ordi.1<-ordiplot(pca.1, type='n', display = c("si", "sp"), scaling=2, ylim=c(-0.7, 0.5), xlab="PC1 (49.6%)", ylab="PC2 (13.1%)") points(ordi.1, what="si") text(ordi.1, what="sp", arrows=T) ordi.2<-ordiplot(pca.1, type='n', display = c("si", "sp"), scaling=2, ylim=c(-0.6, 0.7), xlab="PC1 (49.6%)", ylab="PC3 (9.2%)", choices=c(1,3)) points(ordi.2, what="si") text(ordi.2, what="sp", arrows=T, cex=0.8) # 8 summary(bk.env) library(fastDummies) hemi.dummy<-dummy_cols(bk.env$hemiparasite)[,-1] names(hemi.dummy)<-c("MNE", "RAL", "RMA", "RMI") bk.env.2<-data.frame(bk.env, hemi.dummy) bk.env.2<-bk.env.2[,-2] library(psych) pdf("bk.pairs.pdf", 8,8) pairs.panels(bk.env.2) dev.off() bk.env.3<-bk.env.2 bk.env.3$PMehl3<-log(bk.env.3$PMehl3) bk.env.3$Na<-log(bk.env.3$Na) bk.env.3$Mg<-log(bk.env.3$Mg) bk.env.3$Ca<-log(bk.env.3$Ca) pdf("bk.pairs.2.pdf", 8,8) pairs.panels(bk.env.3) dev.off() pca.bk<-rda(bk.env.3, scale=T) pca.bk screeplot(pca.bk, bstick=T) bk.op.1<-ordiplot(pca.bk, scaling=3, type="n", ylim=c(-1.5, 1.5) ) points(bk.op.1, what="si") text(bk.op.1, what="sp", arrows=T) bk.op.2<-ordiplot(pca.bk, scaling=3, type="n", ylim=c(-1.5, 1.5), choices=c(1,3)) points(bk.op.2, what="si") text(bk.op.2, what="sp", arrows=T)