Learn R Programming

Claddis (version 0.3.4)

CorrectRootTime: Corrects root.time after taxa have been pruned from a tree

Description

Corrects root.time after taxa have been pruned from a tree using drop.tip

Usage

CorrectRootTime(original.tree, pruned.tree)

Arguments

original.tree

A tree in phylo format.

pruned.tree

A tree in phylo format that represents a pruned version of original.tree.

Value

Returns a tree (phylo object) with a corrected $root.time.

Details

(NB: This function is designed to only cope with trees containing at least three tips.)

When removing taxa from a time-scaled tree using drop.tip in ape $root.time is left unchanged. This can cause downstream problems if not corrected and that is what this function does.

Note that fixRootTime in the paleotree package performs the same function, but is not called here to reduce the number of libraries on which Claddis is dependent. Interested users should also refer to the dropPaleoTip function in paleotree.

Examples

Run this code
# NOT RUN {
# Create a simple four-taxon tree with branch lengths:
tree <- read.tree(text = "(A:1,(B:1,(C:1,D:1):1):1);")

# Set root age as 20 Ma:
tree$root.time <- 20

# Now prune taxon A:
pruned.tree <- drop.tip(tree, "A")

# Show that drop.tip has not updated the tree's root time:
pruned.tree$root.time

# Use the function to correct the root time:
pruned.tree <- CorrectRootTime(tree, pruned.tree)

# Show that the root time is now correct (19 Ma):
pruned.tree$root.time

# }

Run the code above in your browser using DataLab