| fixRootTime | R Documentation |
Modifying a dated tree with $root.time elements often
changes the actual timing of the root relative to the
tips, such as when dropping tips, extending branches, or
shift node ages backwards. When such modifications occur,
the function fixRootTime can be used to find
the correct root age.
This function is mainly used as a
utility function called by other tree-modifying functions discussed
in the manual page for modifyTerminalBranches.
This is typically performed via the function fixRootTime.
fixRootTime(
treeOrig,
treeNew,
testConsistentDepth = TRUE,
fixingMethod = "matchCladeTransferNodeAge"
)
treeOrig |
A |
treeNew |
A |
testConsistentDepth |
A logical, either |
fixingMethod |
must be an character value, with a length of 1. The default option If |
Gives back a modified phylogeny as a phylo object, with a
modified $root.time element.
David W. Bapst
modifyTerminalBranches,
minBranchLength
#testing dropPaleoTip... and fixRootTime by extension
#simple example
tree <- read.tree(text = "(A:3,(B:2,(C:5,D:3):2):3);")
tree$root.time <- 10
plot(tree,no.margin = FALSE)
axisPhylo()
# now a series of tests, dropping various tips
(test <- dropPaleoTip(tree,"A")$root.time) # = 7
(test[2] <- dropPaleoTip(tree,"B")$root.time) # = 10
(test[3] <- dropPaleoTip(tree,"C")$root.time) # = 10
(test[4] <- dropPaleoTip(tree,"D")$root.time) # = 10
(test[5] <- dropPaleoTip(tree,c("A","B"))$root.time) # = 5
(test[6] <- dropPaleoTip(tree,c("B","C"))$root.time) # = 10
(test[7] <- dropPaleoTip(tree,c("A","C"))$root.time) # = 7
(test[8] <- dropPaleoTip(tree,c("A","D"))$root.time) # = 7
# is it all good? if not, fail so paleotree fails...
if(!identical(test,c(7,10,10,10,5,10,7,7))){stop("fixRootTime fails!")}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.