make.treedata: Function for making an object of class 'treedata'

View source: R/treeplyr_functions.R

make.treedataR Documentation

Function for making an object of class treedata

Description

This function generates an object of class treedata that ensures that the ordering of tip labels and data remain intact. The object can be manipulated using dplyr functions.

Usage

make.treedata(tree, data, name_column = "detect")

Arguments

tree

An object of class 'phylo'

data

A data frame or matrix

name_column

An optional argument that specifies the column of data that contains the names to be matched to the tree. By default, it is set to "detect" which finds the column with the most matches to the tree (including the rownames).

Value

An object of class "treedata". The tree is pruned of tips not represented in the data, and the data is filtered for taxa not in the tree. The data is returned as a data frame tble that is compatible with dplyr functions.

Examples

data(anolis)
td <- make.treedata(anolis$phy, anolis$dat)

uyedaj/treeplyr documentation built on March 9, 2023, 6:37 p.m.