View source: R/summaryStatistics.R
validate_tree | R Documentation |
This function checks whether the input is a valid phylogenetic tree, either as a character string in Newick format
or as an object of class phylo
from the ape
package. If the input is a Newick string, it is parsed into
a phylo
object. The function also ensures that the tree contains at least two tips.
validate_tree(tree)
tree |
A phylogenetic tree in Newick format (as a character string) or an object of class
|
The function first verifies that the input is either a valid phylo
object or a character string.
If the input is a Newick string, it attempts to parse it into a phylo
object using ape::read.tree()
.
If parsing fails, an informative error message is returned.
The function also checks that the tree contains at least two tips, as a valid phylogenetic tree should have at least one split.
A phylo
object representing the validated and parsed tree.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.