Learn R Programming

rbiom (version 2.1.2)

tree_subset: Create a subtree by specifying tips to keep.

Description

Create a subtree by specifying tips to keep.

Usage

tree_subset(tree, tips, underscores = FALSE)

Value

A phylo object for the subtree.

Arguments

tree

A phylo object, as returned from read_tree().

tips

A character, numeric, or logical vector of tips to keep.

underscores

When parsing the tree, should underscores be kept as is? By default they will be converted to spaces (unless the entire ID is quoted). Default FALSE

See Also

Other phylogeny: read_tree()

Examples

Run this code
    library(rbiom)
    
    infile <- system.file("extdata", "newick.tre", package = "rbiom")
    tree <- read_tree(infile)
    tree
    
    subtree <- tree_subset(tree, tips = head(tree$tip.label))
    subtree

Run the code above in your browser using DataLab