"ape"
(Paradis et al 2004)
"ade4"
(Dray & Dufour, 2007; Chessel et al. 2004; Dray et al. 2007)
"MASS"
(Venables & Ripey, 2004)
"picante"
(Kembel et al., 2010)
"apTreeshape"
(Bartolussi et al. 2012)
"spacodiR"
(Eastman et al., 2013)
"phylobase"
(R Hackathon et al. 2013)
"phyloseq"
(McMurdie & Holmes, 2013)
METRIC CODE ("metrics.R"
), Novel code to calculate community phylogenetic metrics
WRAPPER CODE ("functions.R"
), Wrapper code to rapidly calculate the shape, evenness, and dispersion metrics described in the chapter
FIGURE 2 ANALYSES ("figures.R"
), Code used to generate figure 2 in the chapter, and use the above files to calculate metrics and compare them
PGLMM ANALYSES ("pglmm.R"
), Code to calculate the PGLMM models in the chapter
METRIC TABLES ("tables.pdf"
), Description of additional metrics and their placement into the framework described in the chapter. Also the abbreviations used in figure 2 in the chapter.
The file functions.R shows how the metrics described in the chapter can be calculated. However, below is a more annotated example that shows how the functions can be used.
#Load the functions written for the chapter source('functions.R')
#Load example data from 'picante' data(phylocom) #Prune species from the phylogeny missing from the community data tree <- drop.tip(phylocom$phy, setdiff(phylocom$phy$tip.label, colnames(phylocom$sample))) #Calculate metrics! (ignore the warnings) shape <- shape.metrics(phylocom$sample, tree)
evenness <- evenness.metrics(phylocom$sample, tree)
dispersion <- dispersion.metrics(phylocom$sample, tree) #Take a quick look! head(shape)
## PSV PSR SR MPD PD regPD Ic Gamma TDI_Dplus TDI_SRDplus ## clump1 0.4857 3.886 8 4.857 16 -4.8824 9 -1.131 7.929 63.43 ## clump2a 0.6000 4.800 8 6.000 17 -4.8235 6 -1.131 8.000 64.00 ## clump2b 0.7143 5.714 8 7.143 18 -3.8235 6 -1.061 7.714 61.71 ## clump4 0.8286 6.629 8 8.286 22 0.1765 5 -1.131 8.357 66.86 ## even 0.8857 7.086 8 8.857 30 9.1176 6 -2.222 8.571 68.57 ## random 0.8429 6.743 8 8.429 27 4.2353 11 -1.471 7.500 60.00 ## PEsumvar Eed Hed ## clump1 0.03563 NA NA ## clump2a 0.04493 NA NA ## clump2b 0.03985 NA NA ## clump4 0.04539 NA NA ## even 0.04985 NA NA ## random 0.02268 NA NA