#### Using APE package to convert the dendrograms to phylo, so that the "phylo" objects can be saved as newick tree files for subsequent analysis. library(ape) tree.trait1 <- as.phylo(hclust.trait1) tree.trait2 <- as.phylo(hclust.trait2) tree.trait3 <- as.phylo(hclust.trait3) tree.trait4 <- as.phylo(hclust.traits)
#### Save the phylogenies to disk write.tree(tree.trait1, "tree.trait1.tre") write.tree(tree.trait2, "tree.trait2.tre") write.tree(tree.trait3, "tree.trait3.tre") write.tree(tree.trait4, "tree.trait4.tre")