as.phylo {aphylo} | R Documentation |
Extensions to the as.phylo
function
Description
This function takes an edgelist and recodes (relabels) the nodes following ape's coding convention.
Usage
## S3 method for class 'matrix'
as.phylo(x, edge.length = NULL, root.edge = NULL, ...)
## S3 method for class 'aphylo'
as.phylo(x, ...)
Arguments
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. |
Value
An integer matrix of the same dimmension as edges
with the following
aditional attribute:
labels |
Named integer vector of size |
Examples
# 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)
[Package aphylo version 0.3-3 Index]