Add tip to a tree

Share:

Description

Returns a tree with a tip ID added

Usage

1
addTip(tree, tid, sid, start, end, pid = paste0("p_", tid))

Arguments

tree

TreeMan object

tid

tip ID

sid

ID of node that will become new tip's sister

start

start time

end

end time

pid

parent ID (default is 'p_' + tid)

Details

User must provide a new tip ID, the ID of a node which will become the new tip's sister, a start time point to specify when the new branch will start in time and, an end time point (0 for extant tips).

See Also

rmTip, https://github.com/DomBennett/treeman/wiki/manip-methods

Examples

1
2
3
4
5
6
7
8
library(treeman)
tree <- randTree(10)
# add a new tip to the branch preceding t1
# calculate the span and find a point in that time frame for start
t1_spn <- getSpnAge(tree, 't1')
start <- runif(max=t1_spn[1, 'start'], min=t1_spn[1, 'end'], n=1)
end <- runif(max=start, min=0, n=1)
tree <- addTip(tree, tid='t11', sid='t1', start=start, end=end)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.