Converting between phylo4/phylo4d and other phylogenetic tree formats
Translation functions to convert between phylobase objects
(phylo4 or phylo4d), and objects used by other
comparative methods packages in R: ape objects
(phylo, multiPhylo), RNeXML object
(nexml), ade4 objects (phylog, now
deprecated), and to data.frame representation.
as(object, class)
Ben Bolker, Thibaut Jombart, Marguerite Butler, Steve Kembel, Francois Michonneau
generic as,
phylo4-methods, phylo4d-methods,
extractTree, nexml class from the
RNeXML package, phylog from the
ade4 package and as.phylo from the
ape package.
tree_string <- "(((Strix_aluco:4.2,Asio_otus:4.2):3.1,Athene_noctua:7.3):6.3,Tyto_alba:13.5);" tree.owls <- ape::read.tree(text=tree_string) ## round trip conversion tree_in_phylo <- tree.owls # tree is a phylo object (tree_in_phylo4 <- as(tree.owls,"phylo4")) # phylo converted to phylo4 identical(tree_in_phylo,as(tree_in_phylo4,"phylo")) ## test if phylo, and phylo4 converted to phylo are identical ## (no, because of dimnames) ## Conversion to phylog (ade4) as(tree_in_phylo4, "phylog") ## Conversion to data.frame as(tree_in_phylo4, "data.frame") ## Conversion to phylo (ape) as(tree_in_phylo4, "phylo") ## Conversion to phylo4d, (data slots empty) as(tree_in_phylo4, "phylo4d")
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.