Find the shortest path between tips of a tree
sp.tips(x, tip1, tip2, useTipNames = FALSE, quiet = FALSE, include.mrca = TRUE)
x |
|
tip1 |
A vector of integers identifying tips by their numbers, or a vector of characters identifying tips by their names. Recycled if needed. |
tip2 |
A vector of integers identifying tips by their numbers, or a vector of characters identifying tips by their names. Recycled if needed. |
useTipNames |
a logical stating whether the output must be named using
tip names in all cases (TRUE), or not (FALSE). If not, names of |
quiet |
a logical stating whether a warning must be issued when tip1==tip2, or not (see details). |
include.mrca |
a logical stating whether the most recent common ancestor shall be included in the returned path (TRUE, default) or not (FALSE). |
The function checks if there are cases where tip1 and tip2 are the same.
These cases are deleted when detected, issuing a warning (unless
quiet
is set to TRUE).
A list whose components are vectors of named nodes forming the shortest path between a couple of tips.
Thibaut Jombart tjombart@imperial.ac.uk
shortestPath
which does the same thing as
sp.tips
, for any node (internal or tip), but much more slowly.
## Not run: if(require(ape) & require(phylobase)){ ## make a tree x <- as(rtree(20),"phylo4") plot(x,show.node=TRUE) ## get shortest path between tip 1 and all other tips. sp.tips(x, "t1", "t2") sp.tips(x, 1, 2:20, TRUE) } ## End(Not run)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.