summarise.treedata: Function for summarizing an object of class 'treedata'

View source: R/treeplyr_functions.R

summarise.treedataR Documentation

Function for summarizing an object of class treedata

Description

This function can be used to summarize a treedata object.

Usage

## S3 method for class 'treedata'
summarise(.data, ...)

## S3 method for class 'grouped_treedata'
summarise(.data, ...)

Arguments

.data

An object of class treedata

...

Additional expressions by which to summarize data in the treedata object

Details

Summarizing treedata objects allows expressions using the objects phy. The treedata object can also be grouped, with summary statistics being applied to the pruned groups and phylogenies.

Value

An object of class tbl_df with the requested summary data.

See Also

summarize, group_by

Examples

data(anolis)
td <- make.treedata(anolis$phy, anolis$dat)
summarize(td, ntips = length(phy$tip.label), meanSVL = mean(SVL), sdSVL = sd(SVL))
tdGrouped <- group_by(td, ecomorph)
summarize(tdGrouped, ntips = length(phy$tip.label),
   totalBL = sum(phy$edge.length), meanSVL = mean(SVL), sdSVL = sd(SVL))

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