keep_tips {rrnni}R Documentation

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 class 'phylo'
keep_tips(x, tips)

## S3 method for class 'multiPhylo'
keep_tips(x, tips)

## S3 method for class 'rankedPhylo'
keep_tips(x, tips)

Arguments

x

a tree of class "phylo" or "multiPhylo"

tips

tip labels to keep

Value

a pruned tree or a collection

Examples

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)


[Package rrnni version 0.1.1 Index]