### File S4: Code for the data analysis in R. ### Authors: Abrego N, García-Baquero G, Halme P, Ovaskainen O & Salcedo I ### Manuscript title: Community turnover of wood-inhabiting fungi across hierarchical spatial scales ### Corresponding author: nerea.abrego@ehu.es ################################################################################ ################################################################################ ###Figure 1->Species and dead wood abundance distributions # Load vegan package library(vegan) ##Figure 1a->The species abundance distributions based on the total number of observations ##made on each species # Count how many of species have occurred once, twice...in different forest types Fungi <- read.csv("FileS5.csv", header = TRUE, sep=";") spe <- Fungi[,c(1:285)] Nobssp<-colSums(spe)#Total number of observations of each species # Split the data matrices in two according to the management factor Managed<-Fungi[c(1:40),c(1:285)] SpManag<-colSums(Managed) SpManag<-(SpManag==1|SpManag>1) Natural<-Fungi[c(41:80),c(1:285)] SpNat<-colSums(Natural) SpNat<-(SpNat==1|SpNat>1) Presence<-SpNat-SpManag# As a factor:0=species that occur in both forest types, 1= species that only #occur in natural forests, -1=species that only occur in managed forests # Plot the graph spocc<-t(rbind(Nobssp,Presence)) maxNobssp<-max(Nobssp) nocc<-matrix(0,3,maxNobssp) for(pres in -1:1){ Nobssp_subset<-subset(spocc,Presence==pres)[,1] for (i in 1:maxNobssp){ nocc[pres+2,i]<-sum(Nobssp_subset==i) } } tiff("Figure 1 A.tiff", width = 4, height = 4, units = 'in', res = 300) barplot(nocc, ylab = "number of species", xlab="number of observations", ylim=c(0, 100), xlim=c(1,100),col=c("blue","yellow","green"),border=NA) axis(1,seq(0,100,10)) text(5, 95, "A",font=2) text(12,85,"rare species",cex=0.75,font=3) text(67,10,"abundant species",cex=0.75, font=3) legend("topright", legend=c("managed forests", "natural and managed forests","natural forests"), ncol=1, fill=c("blue","yellow","green"), border=NA, cex=0.75) dev.off() ##Figure 1b-> The number of plots in which each species was recorded # Count how many species have occurred in one plot, two... Fungi <- read.csv("FileS5.csv", header = TRUE, sep=";") spe <- Fungi[,c(1:285)] spe[spe>1]<-1#convert to presence absence data speplot<-colSums(spe)#occurrence of each species per plot speplot<-(cbind(speplot,Presence)) # Plot the graph maxspeplot<-max(speplot) pocc<-matrix(0,3,maxspeplot) for (pres in -1:1){ pocc_subset<-subset(speplot,Presence==pres)[,1] for (i in 1:maxspeplot){ pocc[pres+2,i]<-sum(pocc_subset==i) } } tiff("Figure 1 B.tiff", width = 4, height = 4, units = 'in', res = 300) barplot((pocc), ylab = "number of species", xlab="number of plots with species occurrence", ylim=c(0, 100), xlim=c(1,80),col=c("blue","yellow","green"),border=NA) axis(1,seq(0,80,10)) text(5, 95, "B",font=2) text(20,80,"infrequent species",cex=0.75,font=3) text(67,10,"common species",cex=0.75,font=3) dev.off() ##Figure 1c->Dead wood abundance distributions based on the total number of observations #made on each dead wood type # Count how many of dead wood pieces of each class have been observed Wood <- read.csv("FileS7.csv", header = TRUE,sep=";") Manag<-Wood[,19] Wood <- Wood[,c(2:16)] WoodManag<-cbind(Wood,Manag) Nobwood<-colSums(Wood)#Total number of observations of each dead wood class maxNobwood<-max(Nobwood)#Total number of examined dead wood pieces WoodManaged<-subset(WoodManag,Manag=="MANAGED") WoodManaged<-colSums(WoodManaged[,1:15]) WoodNatural<-subset(WoodManag,Manag=="NATURAL") WoodNatural<-colSums(WoodNatural[,1:15]) wocc<-rbind(WoodManaged,WoodNatural) # Plot the graph tiff("Figure 1 C.tiff", width = 4, height = 4, units = 'in', res = 300) barplot(wocc, ylab = "number of dead wood pieces", ylim=c(0, 3000), xlim=c(0,17),axes=TRUE,col=c("blue","green"),border=NA,names.arg=c("VFWD 1","VFWD 2","VFWD 3","VFWD 4","VFWD 5","FWD 1","FWD 2","FWD 3","FWD 4","FWD 5","CWD 1","CWD 2","CWD 3","CWD 4", "CWD 5"),cex.names=0.75,las=2) text(1.25, 2900, "C", font=2) dev.off() ################################################################################ ###Figure 2-> Species accumulation curves Fungi <- read.csv("FileS5.csv", header = TRUE, sep=";") spe <- Fungi[,c(2:285)] spe.env <- Fungi[,c(287:289)] ## A function for randomizing the species number from different plots within a given level NoSpecies <- function(set,mode,n,spe.env,spe) { if(mode=="within"){ site<-sample(set$Site,1) set1<-subset(spe.env,Site==site) plots<-sample(set1$OrPlot,n) } else { plots<-sample(set$OrPlot,n) } nspec<-sum(colSums(spe[plots,])>0) return(nspec) } ##The five cases which assume that the plots were selected randomly either within the same randomly selected ##managed forest site (case==1), the same randomly selected natural forest site (case==2), among all sites in ##managed forests (case==3), among all sites in natural forests (case==4), or among all sites (case==5) cols<-c(rainbow(6)[1],rainbow(6)[5],rainbow(6)[3],rainbow(6)[4],rainbow(6)[2]) tcols<-c(rainbow(6,alpha=0.3)[1],rainbow(6,alpha=0.3)[5],rainbow(6,alpha=0.3)[3],rainbow(6,alpha=0.3)[4],rainbow(6,alpha=0.3)[2]) pmax<-80#Maximum number of plots mv<-c(min(pmax,5),min(pmax,5),min(pmax,40),min(pmax,40),pmax) nrepls<-1000#Number of randomizations res<-matrix(0,ncol=pmax,nrow=5) low<-matrix(0,ncol=pmax,nrow=5) high<-matrix(0,ncol=pmax,nrow=5) for(case in 1:5) { m<-pmax if(case==1){ set<-subset(spe.env,Treatment=="Managed") mode<-"within" } if(case==2){ set<-subset(spe.env,Treatment=="Unmanaged") mode<-"within" } if(case==3){ set<-subset(spe.env,Treatment=="Managed") mode<-"among" } if(case==4){ set<-subset(spe.env,Treatment=="Unmanaged") mode<-"among" } if(case==5){ set<-spe.env mode<-"among" } m<-mv[case] for(n in 1:m)##interquartile regions { tmp<-matrix(0,nrepls) for(i in 1:nrepls) { tmp[i]<-NoSpecies(set,mode,n,spe.env,spe) } res[case,n]<-mean(tmp) low[case,n]<-quantile(tmp,0.25) high[case,n]<-quantile(tmp,0.75) } } #Graph tiff("Figure 2 A.tiff", width = 4, height = 4, units = 'in', res = 300) order <- c(3,4,5,2,1) maxy<-max(res)+5 plot(1,type="n",xlim=c(1,pmax),ylim=c(0,maxy),xlab="number of plots",ylab="number of species") for(ca in 1:5) { case <- order[ca] xx<-c(1:mv[case],rev(1:mv[case])) yy<-c(low[case,c(1:mv[case])],rev(high[case,c(1:mv[case])])) polygon(xx,yy,col=tcols[case],border=NA) } for(ca in 1:5) { case<-order[ca] lines(res[case,c(1:mv[case])],col=cols[case],lwd=2) } text(5, 0.95*maxy, "A",font=2) dev.off() tiff("Figure 2 B .tiff", width = 4, height = 4, units = 'in', res = 300) res2<-res[,1:5] low2<-low[,1:5] high2<-high[,1:5] maxy<-max(high2)+5 plot(1,type="n",xlim=c(1,5),ylim=c(0,maxy),xlab="number of plots",ylab="number of species") for(ca in 1:5) { case <- order[ca] xx<-c(1:5,rev(1:5)) yy<-c(low2[case,c(1:5)],rev(high2[case,c(1:5)])) polygon(xx,yy,col=tcols[case],border=NA) } for(ca in 1:5) { case <- order[ca] lines(res2[case,],col=cols[case],lwd=2) } text(1.25, 0.95*maxy, "B",font=2) legend("bottomright", legend=c("within managed sites", "within natural sites", "among managed sites", "among natural sites", "among all sites"), ncol=1, fill=cols,cex=0.7, border=NA,box.lwd = 0,box.col = NA) dev.off() ################################################################################ ### Figure 3-> Additive species diversity partitioning Fungi <- read.csv("FileS5.csv", header = TRUE, sep=";") spe <- Fungi[,c(1:285)] spepa <- spe spepa[spe>0]<-1 spe.env <- Fungi[,c(287:289)] spe.env$OrPlot<-as.factor(spe.env$OrPlot) head(spe.env) str(spe.env) adipart(spepa ~OrPlot + Site + Treatment, data=spe.env, index=c("richness"), weights=c("unif"), relative = FALSE, nsimul=999,method="r0") # Create a data frame with the observed and expected species values SpObs <- c(22.96,67.56,206,44.60,138.44,(285-206.44),285) SpExp <- c(22.96,97,273,74.04,175.75,(285-273),0) RowNames <- c("alpha[1]", "alpha[2]", "alpha[3]", "beta[1]", "beta[2]", "beta[3]", "gamma") Partition <- data.frame(SpObs, SpExp, row.names = RowNames) Partition # Plot species partition tiff("Figure 3.tiff", width = 4, height = 4, units = 'in', res = 300) barplot(t(Partition), beside = TRUE, ylab = "species number", ylim=c(0, 300), names=expression(alpha[1],alpha[2],alpha[3],beta[1],beta[2],beta[3],gamma),col=c("gray50","black"),border=NA) points(5, 110, pch = 8) points(8, 283, pch = 8) points(11, 84, pch = 8) points(14, 186, pch = 8) points(17, 89, pch = 8) legend(11,300, legend=c("observed", "expected"), ncol=1, fill=c("gray50", "black"), border=NA, cex=0.75) dev.off() ################################################################################ ### Figure 4-> Prediction of fungal species similarity across resource similarity and a spatial distance gradient library(vegan) #vector for the overall dead wood similarity matrix Wood<- read.csv("FileS7.csv", header = TRUE,sep=";") Wood.sp <- Wood[,c(2:16)] Wood.sq<-sqrt(Wood.sp) X1<-as.vector(1-(vegdist(Wood.sq,method="bray"))) #Vector for the overall species similarity matrix Fungi <- read.csv("FileS5.csv", header = TRUE, sep=";") Fungi.sp<- Fungi[,c(2:285)] Fungi.sq<-sqrt(Fungi.sp) Y<-as.vector(1-(vegdist(Fungi.sq, method="bray"))) #Vector for the management type #X2=MU if two plots are from different management types, #X2=UU if the two plots are from natural forests, #X2=MM if the two plots are from managed forests Fungi.env <- Fungi[,c(287:289)] Regime<-c(Fungi.env$Treatment) #For given X2=0, X2=1, X2=2 values: tmp<-100+1:80 for(i in 1:80){ if(Regime[i]==1) tmp[i]=0.001*tmp[i] } tmpEuc<-vegdist(tmp,method="euclidean") classMM<-(tmpEuc<0.5)+0 classMU<-(tmpEuc>100)+0 classUU<-1-classMM-classMU X2<-0*classMU+1*classUU+2*classMM for(i in 1:length(X2)){ if(X2[i]==0) X2[i]<-"MU" if(X2[i]==1) X2[i]<-"UU" if(X2[i]==2) X2[i]<-"MM" } X2<-factor(X2) #Vector for the site (X3=1 if the two plots are from the same site, otherwise X3=0) Site<-c(Fungi.env$Site) SiteEuc<-vegdist(Site,method="euclidean") SiteEuc<-matrix(SiteEuc) SiteEuc<-c(SiteEuc) X3<-1-(SiteEuc>0)+0 #Vector for the spatial similarity Fungi.xy <- read.csv("FileS6.csv", header = TRUE, sep=";") X4<-as.vector(log(vegdist(Fungi.xy,method="euclidean"))) ##Model selection for modelling similarity in species composition: model<-6#The best model nrepl<-999 nov=c(6,3,3,2,2,4) #Number of variables in the model if(model==1) M<-lm(Y~X1+X2+X3+X1*X2+X1*X3+X2*X3) if(model==2) M<-lm(Y~X1+X2+X1*X2) if(model==3) M<-lm(Y~X1+X2+X3) if(model==4) M<-lm(Y~X2+X3) if(model==5) M<-lm(Y~X1+X2) if(model==6) M<-lm(Y~X1+X2+X3+X4) F<-anova(M)$"F value" permtable<-matrix(ncol=nov[model],nrow=nrepl) for (i in 1:nrepl){ perm<-sample(nrow(Fungi.sq)) Fungiperm<-Fungi.sq[perm,] Yperm<-1-(vegdist(Fungiperm, method="bray")) if(model==1) Mperm<-lm(Yperm~X1+X2+X3+X1*X2+X1*X3+X2*X3) if(model==2) Mperm<-lm(Yperm~X1+X2+X1*X2) if(model==3) Mperm<-lm(Yperm~X1+X2+X3) if(model==4) Mperm<-lm(Yperm~X2+X3) if(model==5) Mperm<-lm(Yperm~X1+X2) if(model==6) Mperm<-lm(Yperm~X1+X2+X3+X4) Fperm<-anova(Mperm)$"F value" permtable[i,]<-Fperm[1:nov[model]] } #For testing the significance (permutation approach): test<-matrix(0,3,nov[model]) for(i in 1:nov[model]){ test[1,i]<-quantile(permtable[,i],0.05) test[2,i]<-quantile(permtable[,i],0.95) test[3,i]<-F[i] } pars<-M$coefficients b0<-pars[1] bX1<-pars[2] bX2MU<-pars[3] bX2UU<-pars[4] bX3<-pars[5] bX4<-pars[6] Rsq<-summary(M)$r.squared ################################################################################ ##Figure 4a-> Predicted similarity of the fungal composition according to resource similarity cols<-c(rainbow(6)[1],rainbow(6)[5],rainbow(6)[3],rainbow(6)[4],rainbow(6)[2]) tiff("Figure 4 A.tiff", width = 4, height = 4, units = 'in', res = 300) order <- c(3,4,5,2,1) maxy<-0.6 miny<-0 plot(1,type="n",xlim=c(min(X1),max(X1)),ylim=c(miny,maxy),xlab="resource similarity",ylab="fungal similarity") nX1<-length(X1) mex<-rep(0,5) mey<-rep(0,5) mX4<-rep(0,5) for(ca in 1:5){ case <- order[ca] take<-rep(TRUE,nX1) for(i in 1:nX1){ if(case==1) take[i]<-(X2[i]=="MM") && X3[i]==1 if(case==2) take[i]<-(X2[i]=="UU") && X3[i]==1 if(case==3) take[i]<-(X2[i]=="MM") && X3[i]==0 if(case==4) take[i]<-(X2[i]=="UU") && X3[i]==0 if(case==5) take[i]<-(X2[i]=="MU") && X3[i]==0 } points(X1[take],Y[take],cex=0.4,pch=19,col=cols[case]) mX4[case]<-mean(X4[take]) mex[case]<-mean(X1[take]) mey[case]<-mean(Y[take]) } for(case in 1:5) points(mex[case],mey[case],cex=2,pch=17,col=cols[case]) # Range X1 values for each case cases<-data.frame(X1,X2,X3) case1<-subset(cases,X3==1 & X2=="MM") X1C1l<-seq(min(case1$X1),max(case1$X1),(((max(case1$X1)-min(case1$X1))/100))) case2<-subset(cases,X3==1 & X2=="UU") X1C2l<-seq(min(case2$X1),max(case2$X1),(((max(case2$X1)-min(case2$X1))/100))) case3<-subset(cases,X3==0 & X2=="MM") X1C3l<-seq(min(case3$X1),max(case3$X1),(((max(case3$X1)-min(case3$X1))/100))) case4<-subset(cases,X3==0 & X2=="UU") X1C4l<-seq(min(case4$X1),max(case4$X1),(((max(case4$X1)-min(case4$X1))/100))) case5<-subset(cases,X3==0 & X2=="MU") X1C5l<-seq(min(case5$X1),max(case5$X1),(((max(case5$X1)-min(case5$X1))/100))) # Plot regression lines lines(X1C1l,bX1*X1C1l+b0+bX3+(bX4*mX4[1]),col=cols[1],lwd=2)#two plots in the same managed site lines(X1C2l,bX1*X1C2l+b0+bX2UU+bX3+(bX4*mX4[2]),col=cols[2],lwd=2)#two plots in the same natural forest site lines(X1C3l,bX1*X1C3l+b0+(bX4*mX4[3]),col=cols[3],lwd=2)#two different sites in managed forests lines(X1C4l,bX1*X1C4l+b0+bX2UU+(bX4*mX4[4]),col=cols[4],lwd=2)#two different sites in natural forests lines(X1C5l,bX1*X1C5l+b0+bX2MU+(bX4*mX4[5]),col=cols[5],lwd=2)#one site in a managed and one site in a natural forest text(0.3,0.55,"A",font=2) dev.off() ################################################################################ ##Figure 4b-> Predicted similarity of the fungal composition according to spatial distance tiff("Figure 4 B.tiff", width = 4, height = 4, units = 'in', res = 300) cols<-c(rainbow(6)[1],rainbow(6)[5],rainbow(6)[3],rainbow(6)[4],rainbow(6)[2]) maxy<-0.6 miny<-0 plot(1,type="n",xlim=c(min(X4),max(X4)),ylim=c(miny,maxy),xlab="log (spatial distance)",ylab="fungal similarity") nX4<-length(X4) mex<-rep(0,5) mey<-rep(0,5) mX1<-rep(0,5) for(ca in 1:5){ case<-order[ca] take<-rep(TRUE,nX4) for(i in 1:nX4){ if(case==1) take[i]<-(X2[i]=="MM") && X3[i]==1 if(case==2) take[i]<-(X2[i]=="UU") && X3[i]==1 if(case==3) take[i]<-(X2[i]=="MM") && X3[i]==0 if(case==4) take[i]<-(X2[i]=="UU") && X3[i]==0 if(case==5) take[i]<-(X2[i]=="MU") && X3[i]==0 } points(X4[take],Y[take],cex=0.4,pch=19,col=cols[case]) mX1[case]<-mean(X1[take]) mex[case]<-mean(X4[take]) mey[case]<-mean(Y[take]) } for(case in 1:5) points(mex[case],mey[case],cex=2,pch=17,col=cols[case]) #Minimum and maximum X4 values for each case cases<-data.frame(X4,X2,X3) case1<-subset(cases,X3==1 & X2=="MM") X4C1l<-seq(min(case1$X4),max(case1$X4),(((max(case1$X4)-min(case1$X4))/100))) case2<-subset(cases,X3==1 & X2=="UU") X4C2l<-seq(min(case2$X4),max(case2$X4),(((max(case2$X4)-min(case2$X4))/100))) case3<-subset(cases,X3==0 & X2=="MM") X4C3l<-seq(min(case3$X4),max(case3$X4),(((max(case3$X4)-min(case3$X4))/100))) case4<-subset(cases,X3==0 & X2=="UU") X4C4l<-seq(min(case4$X4),max(case4$X4),(((max(case4$X4)-min(case4$X4))/100))) case5<-subset(cases,X3==0 & X2=="MU") X4C5l<-seq(min(case5$X4),max(case5$X4),(((max(case5$X4)-min(case5$X4))/100))) # Plot regression lines lines(X4C1l,bX4*X4C1l+b0+bX3+(bX1*mX1[1]),col=cols[1],lwd=2)#two plots in the same managed site lines(X4C2l,bX4*X4C2l+b0+bX2UU+bX3+(bX1*mX1[2]),col=cols[2],lwd=2)#two plots in the same natural forest site lines(X4C3l,bX4*X4C3l+b0+(bX1*mX1[3]),col=cols[3],lwd=2)#two different sites in managed forests lines(X4C4l,bX4*X4C4l+b0+bX2UU+(bX1*mX1[4]),col=cols[4],lwd=2)#two different sites in natural forests lines(X4C5l,bX4*X4C5l+b0+bX2MU+(bX1*mX1[5]),col=cols[5],lwd=2)#one site in a managed and one site in a natural forest text(4.7,0.55,"B",font=2) dev.off() ################################################################################ ## Spatial structure of raw data and residuals from the model for fungal similarity par(mfrow=c(2,2)) # Raw data Fungi <- read.csv("FileS5.csv", header = TRUE, sep=";") Fungi.sp<- Fungi[,c(2:285)] Fungi.sq<-sqrt(Fungi.sp) Y<-as.vector(1-(vegdist(Fungi.sq, method="bray"))) Fungi.xy <- read.csv("FileS6.csv", header = TRUE, sep=";") Fungi.Y<-matrix(ncol=80,nrow=80,0) index<-0 for (i in 1:79){ for (j in (i+1):80){ index<-index+1 Fungi.Y[j,i]<-Y[index] Fungi.Y[i,j]<-Y[index] } } Fungi.correlog<-mantel.correlog((1-(Fungi.Y)),XY=Fungi.xy,n.class=25,nperm=999) plot(Fungi.correlog) text(30000,0.20,"species similarity") # Residuals M3<-lm(Y~X1+X2+X3) Resid<-resid(M3) Fungi.resid<-matrix(ncol=80,nrow=80,0) index<-0 for (i in 1:79){ for (j in (i+1):80){ index<-index+1 Fungi.resid[j,i]<-Resid[index] Fungi.resid[i,j]<-Resid[index] } } Fungi.correlogII<-mantel.correlog((1-(Fungi.resid)),XY=Fungi.xy,n.class=25,nperm=999) plot(Fungi.correlogII) text(40000,0.07,"residuals") ################################################################################ ## Model selection for modelling similarity in dead wood composition model<-2#The best model nrepl<-999 nov=c(4,2,1) #Number of variables in the model if(model==1) M<-lm(X1~X2+X3+X2*X3+X4) if(model==2) M<-lm(X1~X2+X3) if(model==3) M<-lm(X1~X3+X4) if(model==4) M<-lm(X1~X3) F<-anova(M)$"F value" permtable<-matrix(ncol=nov[model],nrow=nrepl) for (i in 1:nrepl){ perm<-sample(nrow(Wood.sq)) Woodperm<-Wood.sq[perm,] X1perm<-(1-(vegdist(Woodperm, method="bray"))) if(model==1) Mperm<-lm(X1perm~X2+X3+X2*X3+X4) if(model==2) Mperm<-lm(X1perm~X2+X3) if(model==3) Mperm<-lm(X1perm~X3+X4) if(model==4) Mperm<-lm(X1perm~X3) Fperm<-anova(Mperm)$"F value" permtable[i,]<-Fperm[1:nov[model]] } #For testing the significance: test<-matrix(0,3,nov[model]) for(i in 1:nov[model]){ test[1,i]<-quantile(permtable[,i],0.05) test[2,i]<-quantile(permtable[,i],0.95) test[3,i]<-F[i] } pars<-M$coefficients b0<-pars[1] bX2MU<-pars[2] bX2UU<-pars[3] Rsq<-summary(M)$r.squared ################################################################################ ## Spatial structure of raw data and residuals from the best model for dead wood similarity Fungi.xy <- read.csv("FileS6.csv", header = TRUE, sep=";") # Raw data Wood.X1<-matrix(ncol=80,nrow=80,0) index<-0 for (i in 1:79){ for (j in (i+1):80){ index<-index+1 Wood.X1[j,i]<-X1[index] Wood.X1[i,j]<-X1[index] } } Wood.correlog<-mantel.correlog((1-Wood.X1),XY=Fungi.xy,n.class=25,nperm=999) plot(Wood.correlog) text(30000,0.08,"wood similarity") # Residuals M3b<-lm(X1~X2+X3) Resid<-resid(M3b) Wood.dist<-vegdist(Fungi.xy,method="euclidean") Wood.resid<-matrix(ncol=80,nrow=80,0) index<-0 for (i in 1:79){ for (j in (i+1):80){ index<-index+1 Wood.resid[j,i]<-Resid[index] Wood.resid[i,j]<-Resid[index] } } Wood.correlogII<-mantel.correlog((1-(Wood.resid)),XY=Fungi.xy,n.class=25,nperm=999) plot(Wood.correlogII) text(40000,0.02,"residuals") ################################################################################ ### Partitioning community variation by Permanova # Load data and packages: Fungi <- read.csv("FileS5.csv", header = TRUE, sep=";") spe <- Fungi[,c(2:285)] Fungi.sq<-sqrt(spe) Wood <- read.csv("FileS7.csv", header = TRUE,sep=";") Wood <- Wood[,c(2:16)] Wood.sq<-sqrt(Wood) Fungi.env <- Fungi[,c(287:289)] library(BiodiversityR) library(permute) npmFungi.BC <- nested.npmanova(Fungi.sq~Treatment+Site, data=Fungi.env, method="bray",permutations=999) npmWood.BC <- nested.npmanova(Wood.sq~Treatment+Site, data=Fungi.env, method="bray",permutations=999)