adjust_data: Adjusts the tree and traits to meet the requirements of...

Description Usage Arguments Value Examples

View source: R/tools.R

Description

Returns a new tree and new data matrix, where the tree edges are in postorder, and the data row names match the order of the tree tip labels.

Usage

1
adjust_data(tree, Y, normalize = TRUE, quietly = FALSE)

Arguments

tree

ultrametric tree of class phylo with branch lengths.

Y

trait vector/matrix without missing entries.

normalize

logical. If TRUE, normalizes branch lengths to a unit tree height.

quietly

logical. If FALSE, changes in tree/trait are printed.

Value

tree

tree of class phylo, with the same topology as the input tree but adjusted edge order.

Y

trait vector/matrix with adjusted row names and row order.

Examples

1
2
3
4
5
6
7
8
data(lizard.tree, lizard.traits)
# here, lizard.traits is a matrix, so columns retain row names:
names(lizard.traits[,1])
lizard <- adjust_data(lizard.tree, lizard.traits[,1])

# for a data frame, make sure to retain row names if a single column is selected:
lizard.traits <- as.data.frame(lizard.traits)
lizard <- adjust_data(lizard.tree, subset(lizard.traits, select=1))

khabbazian/l1ou documentation built on July 30, 2018, 12:05 p.m.