Learn R Programming

treeplyr (version 0.1.10)

tdapply: Apply a function over all treedata object columns and return a list of results, analogously to the normal apply function

Description

Apply a function over all treedata object columns and return a list of results, analogously to the normal apply function

Usage

tdapply(tdObject, MARGIN, FUN, ...)

Arguments

tdObject

A treedata object

MARGIN

the margin over which the data is applied (e.g. 1 = rows, 2 = columns)

FUN

A function to apply over the data frame

...

Additional parameters passed on to FUN

Details

Note that if the parameter phy is specified in the additional parameters (i.e. '...'), then it will be substituted with the treedata object $phy.

Examples

Run this code
# NOT RUN {
data(anolis)
td <- make.treedata(anolis$phy, anolis$dat)
td %>% forceNumeric(.) %>% tdapply(., 2, phytools::phylosig, tree=phy)
# }

Run the code above in your browser using DataLab