Description Usage Author(s) See Also Examples
Translation functions to convert between phylobase objects
(phylo4
or phylo4d
), and objects used by other
comparative methods packages in R: ape
objects
(phylo
, multiPhylo
), ade4
objects
(phylog
, now deprecated), and to data.frame
representation.
as(object, class)
Ben Bolker, Thibaut Jombart, Marguerite Butler, Steve Kembel
generic as
, phylo4
,
phylo4d
, extractTree
, the original
phylog
from the ade4
package and
as.phylo
from the ape
package.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | tree.owls <- ape::read.tree(text="(((Strix_aluco:4.2,Asio_otus:4.2):3.1,Athene_noctua:7.3):6.3,Tyto_alba:13.5);")
## 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")
|
label node ancestor edge.length node.type
1 Strix_aluco 1 7 4.2 tip
2 Asio_otus 2 7 4.2 tip
3 Athene_noctua 3 6 7.3 tip
4 Tyto_alba 4 5 13.5 tip
5 <NA> 5 0 NA root
6 <NA> 6 5 6.3 internal
7 <NA> 7 6 3.1 internal
[1] FALSE
Phylogenetic tree with 4 leaves and 3 nodes
$class: phylog
$call: ade4::newick2phylog(x.tre = xstring)
$tre: (Tyto_alba,(Athene_noctua...aluco,Asio_otus)I1)I2)Root;
class length content
$leaves numeric 4 length of the first preceeding adjacent edge
$nodes numeric 3 length of the first preceeding adjacent edge
$parts list 3 subsets of descendant nodes
$paths list 7 path from root to node or leave
$droot numeric 7 distance to root
class dim content
$Wmat matrix 4-4 W matrix : root to the closest ancestor
$Wdist dist 6 Nodal distances
$Wvalues numeric 3 Eigen values of QWQ/sum(Q)
$Wscores data.frame 4-3 Eigen vectors of QWQ '1/n' normed
$Amat matrix 4-4 Topological proximity matrix A
$Avalues numeric 3 Eigen values of QAQ matrix
$Adim integer 1 number of positive eigen values of QAQ
$Ascores data.frame 4-3 Eigen vectors of QAQ '1/n' normed
$Aparam data.frame 3-3 Topological indices for nodes
$Bindica data.frame 4-3 class indicator from nodes
$Bscores data.frame 4-3 Topological orthonormal basis '1/n' normed
$Blabels character 3 Nodes labelling from orthonormal basis
Warning message:
In asMethod(object) :
ade4::phylog objects are deprecated, please use the adephylo package instead
label node ancestor edge.length node.type
1 Strix_aluco 1 7 4.2 tip
2 Asio_otus 2 7 4.2 tip
3 Athene_noctua 3 6 7.3 tip
4 Tyto_alba 4 5 13.5 tip
5 <NA> 5 0 NA root
6 <NA> 6 5 6.3 internal
7 <NA> 7 6 3.1 internal
Phylogenetic tree with 4 tips and 3 internal nodes.
Tip labels:
[1] "Strix_aluco" "Asio_otus" "Athene_noctua" "Tyto_alba"
Rooted; includes branch lengths.
No data associated with the tree
label node ancestor edge.length node.type
1 Strix_aluco 1 7 4.2 tip
2 Asio_otus 2 7 4.2 tip
3 Athene_noctua 3 6 7.3 tip
4 Tyto_alba 4 5 13.5 tip
5 <NA> 5 0 NA root
6 <NA> 6 5 6.3 internal
7 <NA> 7 6 3.1 internal
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.