Learn R Programming

rrnni (version 0.1.1)

keep_tips: Prune a tree

Description

Prune a tree or a collection of trees and keep only requested tips.

Usage

keep_tips(x, tips)

# S3 method for phylo keep_tips(x, tips)

# S3 method for multiPhylo keep_tips(x, tips)

# S3 method for rankedPhylo keep_tips(x, tips)

Value

a pruned tree or a collection

Arguments

x

a tree of class "phylo" or "multiPhylo"

tips

tip labels to keep

Examples

Run this code
tree = rankedPhylo(5)
# select randomly 3 tips to keep
tips = sample(tips(tree), 3)
keep_tips(tree, tips)

trees = rankedPhylo(3:7)
# get tips from the first tree
tips = tips(trees[[1]])
# prune all trees, all of them will have 3 tips
keep_tips(trees, tips)

Run the code above in your browser using DataLab