paint_clades: Add regimes to a treedata object

Description Usage Arguments Examples

View source: R/treeplyr_functions.R

Description

This function paints clades on the phylogeny and adds a data column that specifies to which clade each species belongs

Usage

1
2
3
4
5
6
7
8
9
paint_clades(
  tdObject,
  nclades = 1,
  name = "clades",
  interactive = TRUE,
  type = "nodes",
  ids = NULL,
  plot = TRUE
)

Arguments

tdObject

A treedata object

nclades

The number of clades that will be specified if used interactively

name

The name of the resulting data column

interactive

If TRUE, then a plot will appear that will allow the user to click on nclades branches. The selections will then be coverted into the data table.

type

Either "nodes" or "branches" specifying if the ids provided specify the branch id (assuming a post-ordered tree) or the node number. Ignored if interactive = TRUE.

ids

A vector of node numbers of branch numbers that specify clades. Ignored if interactive=TRUE.

plot

If TRUE and interactive = FALSE then a simmap plot is produced.

Examples

1
2
3
4
5
6
7
8
9
data(anolis)
td <- make.treedata(anolis$phy, anolis$dat)
td <- reorder(td, "postorder")
td.painted <- paint_clades(td, interactive=FALSE, type="nodes",
                                   ids=c(184, 160, 135, 122), plot=TRUE)
td.painted <- group_by(td.painted, clades)
summarise(td.painted,
             psig1 = phytools::phylosig(setNames(SVL, phy$tip.label), tree=phy),
                   meanSVL = mean(SVL))

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