fix_root_time {Claddis}R Documentation

Fixes root.time after taxa have been pruned from a tree

Description

Fixes root.time after taxa have been pruned from a tree using ape::drop.tip

Usage

fix_root_time(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.

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 fixed and that is what this function does.

Note that fix_root_time 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.

Value

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

Author(s)

Graeme T. Lloyd graemetlloyd@gmail.com

Examples


# Create a simple four-taxon tree with branch lengths:
tree <- ape::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 <- ape::drop.tip(phy = tree, tip = "A")

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

# Use the function to fix the root time:
pruned_tree <- fix_root_time(original_tree = tree, pruned_tree = pruned_tree)

# Show that the root time is now fixed (19 Ma):
pruned_tree$root.time

[Package Claddis version 0.6.3 Index]