Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

setAs-methods

Converting between phylo4/phylo4d and other phylogenetic tree formats


Description

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.

Usage

as(object, class)

Author(s)

Ben Bolker, Thibaut Jombart, Marguerite Butler, Steve Kembel, Francois Michonneau

See Also

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.

Examples

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")

phylobase

Base Package for Phylogenetic Structures and Comparative Data

v0.8.10
GPL (>= 2)
Authors
R Hackathon et al. (alphabetically: Ben Bolker, Marguerite Butler, Peter Cowan, Damien de Vienne, Dirk Eddelbuettel, Mark Holder, Thibaut Jombart, Steve Kembel, Francois Michonneau, David Orme, Brian O'Meara, Emmanuel Paradis, Jim Regetz, Derrick Zwickl)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.