tree_subset: Create a subtree by specifying tips to keep.

tree_subsetR Documentation

Create a subtree by specifying tips to keep.

Description

Create a subtree by specifying tips to keep.

Usage

tree_subset(tree, tips, underscores = FALSE)

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

Value

A phylo object for the subtree.

See Also

Other phylogeny: read_tree()

Examples

    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


rbiom documentation built on April 3, 2025, 6:39 p.m.