Skip to content

Instantly share code, notes, and snippets.

@willpearse
Created March 5, 2017 00:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save willpearse/18a05d3f2e6041c7a72df6feecf3e61d to your computer and use it in GitHub Desktop.
Save willpearse/18a05d3f2e6041c7a72df6feecf3e61d to your computer and use it in GitHub Desktop.
Calculating PD for managers
#Loading a package
library(pez)
#Building a tree
tree <- read.tree("Vascular_Plants_rooted.dated.tre") #file from http://datadryad.org/resource/doi:10.5061/dryad.63q27
species <- c("Quercus_notreal","Pinus_notreal","Blasia_notreal","Riccia_notreal")
tree <- congeneric.merge(tree, species)
tree <- drop.tip(tree, setdiff(tree$tip.label, species))
#Calculating PD
c.data <- comparative.comm(tree, community.data)
.pd(c.data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment