Learn R Programming

treeplyr (version 0.1.7)

treeply: Run a function on the phylogeny of a treedata object

Description

Applies a function to the phylogeny in a treedata object. If the order of tips are changed, or if tips are dropped, then the data are automatically reordered to match the tree.

Usage

treeply(tdObject, ...)

# S3 method for treedata treeply(tdObject, FUN, ...)

Arguments

tdObject

An object of class treedata

...

Additional arguments

FUN

A function that operates on an object of class 'phylo'

Value

An object of class treedata

Examples

Run this code
# NOT RUN {
data(anolis)
td <- make.treedata(anolis$phy, anolis$dat)
td2 <- treeply(td, drop.tip, 1:50)
  
par(mfrow=c(1,2))
plot(td$phy)
plot(td2$phy)

# }

Run the code above in your browser using DataLab