testEdgeMat {paleotree} | R Documentation |
Test the Edge Matrix of a 'phylo
' Phylogeny Object for Inconsistencies
Description
testEdgeMat
is a small simple function which tests
the $edge
matrix of phylo
objects for
inconsistencies that can cause downstream analytical problems.
The associated function, cleanNewPhylo
puts an input
phylo
object, presumably freshly created or
reconstituted by some function, through a series
of post-processing, This includes having singles collapsed,
nodes reordered and being written out as a Newick string and read back in,
to ensure functionality with ape functions
and ape
-derived functions.
Usage
testEdgeMat(tree)
cleanNewPhylo(tree)
Arguments
tree |
A phylogeny object of type |
Details
Useful when doing complex manipulations of phylo
objects (or reconstituting them, or their
de novo construction), and thus is used by a number of paleotree
functions.
Value
For testEdgeMat
, if all the checks in the function pass correctly,
the logical TRUE
is returned.
For cleanNewPhylo
, an object of class phylo
is returned.
Author(s)
David W. Bapst, with a large number of tests incorporated from
Emmanuel Paradis's checkValidPhylo
function in package ape
,
(released under the GPL v>2).
Examples
set.seed(444)
tree <- rtree(10)
# should return TRUE
testEdgeMat(tree)
# should also work on star trees
testEdgeMat(stree(10))
# should also work on trees with two taxa
testEdgeMat(rtree(2))
# should also work on trees with one taxon
testEdgeMat(stree(1))
#running cleanNewPhylo on this tree should have little effect
#beyond ladderizing it...
tree1 <- cleanNewPhylo(tree)
#compare outputs
layout(1:2)
plot(tree)
plot(tree1)
layout(1)