treeTrimmer: Rboretum Tree Trimmer

View source: R/treeTrimmer.R

treeTrimmerR Documentation

Rboretum Tree Trimmer

Description

This function returns a phylo or multiPhylo object that has been pruned to include only specified taxa. Note: Function will STOP if any 'tree' is missing any 'taxa' or if trimming will result in <2 final taxa

Usage

treeTrimmer(tree, taxa, remove)

Arguments

tree

Tree(s) to trim. Options include:

  • A phylo object

  • A multiPhylo object

taxa

Character vector (or semicolon-separated list) of desired tip labels to keep (or discard if remove=TRUE)

remove

OPTIONAL: If TRUE, tip labels specified by 'taxa' are removed from all trees rather than retained [Default: FALSE, prune 'tree' down to 'taxa']

Value

Pruned phylo or multiPhylo object

Examples

# myTree is a phylo object with 4 tips
desiredTaxa <- c('Species_1','Species_2','Species_3')
undesiredTaxa <- 'Species_4'
trimmedTree <- treeTrimmer(myTree,desiredTaxa) # Trim myTree down to taxa in 'desiredTaxa'
trimmedTree <- treeTrimmer(myTree,undesiredTaxa,remove=TRUE) # Remove 'undesiredTaxa' from myTree

BobLiterman/Rboretum documentation built on July 6, 2023, 7:46 p.m.