Learn R Programming

paleotree (version 2.5)

testEdgeMat: 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 phylo

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.

Details

Useful when doing complex manipulations and reconstitutions of 'phylo' objects (or their de novo construction), and thus is used by a number of paleotree functions.

Examples

Run this code
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)

Run the code above in your browser using DataLab