as.phylo | R Documentation |
as.phylo
functionThis function takes an edgelist and recodes (relabels) the nodes following ape's coding convention.
## S3 method for class 'matrix'
as.phylo(x, edge.length = NULL, root.edge = NULL, ...)
## S3 method for class 'aphylo'
as.phylo(x, ...)
x |
Either an edgelist or an object of class aphylo. |
edge.length |
A vector with branch lengths (optional). |
root.edge |
A numeric scalar with the length for the root node (optional). |
... |
Further arguments passed to the method. |
An integer matrix of the same dimmension as edges
with the following
aditional attribute:
labels |
Named integer vector of size |
# A simple example ----------------------------------------------------------
# This tree has a coding different from ape's
mytree <- matrix(c(1, 2, 1, 3, 2, 4, 2, 5), byrow = TRUE, ncol=2)
mytree
ans <- as.phylo(mytree)
ans
plot(ans)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.