group_by.treedata: Function for grouping an object of class 'treedata'

Description Usage Arguments Details Value See Also Examples

View source: R/treeplyr_functions.R

Description

This function can be used to group a treedata object by some factor.

Usage

1
2
3
4
5
## S3 method for class 'treedata'
group_by(.data, ..., .add = FALSE)

## S3 method for class 'grouped_treedata'
ungroup(x, ...)

Arguments

.data

An object of class treedata

...

The name of the grouping factor.

.add

By default, when .add = FALSE, group_by will override existing groups. To instead add to the existing groups, use .add = TRUE

x

An object of class treedata

Details

Groups the data frame and phylogeny by one of the factors in the data table.

Value

An object of class grouped_treedata.

See Also

summarize

Examples

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

treeplyr documentation built on Sept. 17, 2020, 5:07 p.m.