sim_srt: Simulate a set of complete trees given the observed tree

Usage Arguments Value Examples

Usage

1
sim_srt(wt, pars, parallel = F, n_trees)

Arguments

wt

waiting times of extant species

pars

parameters for the reconstruction

parallel

if parallel=TRUE then the algorithm will be running in parallel using n-1 of the cores of your computer

n_trees

number of trees to simulate

Value

list with n_trees simulated complete trees

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (wt, pars, parallel = F, n_trees)
{
    if (parallel) {
        trees <- foreach(i = 1:n_trees, combine = list) %dopar%
            dmea::rec_tree(w = tree$t, pars = pars)
    }
    else {
        trees = vector("list", length = n_trees)
        for (i in 1:n_trees) {
            rec = dmea::rec_tree(wt = wt, pars = pars)
            trees[[i]] = rec
        }
    }
    return(trees)
  }

franciscorichter/dmea documentation built on May 16, 2019, 1:54 p.m.