rsubtree: Randomly sample clades

Description Usage Arguments Details Value

View source: R/rsubtree.R

Description

Return random samples of the internal nodes of a phylogeny

Usage

1
2
rsubtree(phy, n = 1, extract = TRUE, replace = TRUE,
  include.root = FALSE, cache = TRUE)

Arguments

phy

A phylogeny that inherits class phylo and extended-phylo.

n

Number of samples to take. Default is 1.

extract

Should sampled nodes be extracted as new phylogenies? Default is TRUE.

replace

Should sampling be conducted with replacement? Default is TRUE.

include.root

Should the root node be included as a canditate for sampling? Default is FALSE.

cache

If extract=TRUE should the descendants be cached?

Details

Sample weights are constructed so that each size of subclade has an equal probability of being sampled. e.g. The function is just as likely to sample a node with 2 terminal descendants as a node with 100 terminal descendants. Note, this does not mean that there is an equal probability of sampling a node with 2 - 10 descendants as there is of sampling a node with 100 - 200 descendants (there are still many more nodes with 2 - 10 descendants than there are nodes with 100 - 200 descendants).

Value

Either a vector of node numbers (if extract=FALSE) or a list of phylo objects (if extract=TRUE).


blueraleigh/pea.toolkits documentation built on Dec. 24, 2017, 3:20 p.m.