Learn R Programming

MorphSim (version 0.1.0)

get.reconstructed: Add reconstructed tree and matrix to morpho object

Description

Function to add the reconstructed tree and corresponding reconstructed matrix to an existing morpho object

Usage

get.reconstructed(data)

Value

a `morpho object`

Arguments

data

`morpho object` containing a fossil object

Examples

Run this code
# simulate tree
lambda = 0.1
mu = 0.05
tips = 10
t = TreeSim::sim.bd.taxa(n = tips, numbsim = 1, lambda = lambda, mu = mu)[[1]]

# Simulate fossils and extant taxa
rate = 0.1 # poisson sampling rate
f = FossilSim::sim.fossils.poisson(rate = rate, tree = t, root.edge = FALSE)
rho = 0.5
f2 = FossilSim::sim.extant.samples(fossils = f, tree = t, rho = rho)
morpho_data <-  sim.morpho(k = c(2,3),
                           time.tree = t,
                           trait.num = 6,
                           ancestral = TRUE,
                           br.rates = 0.1,
                           partition = c(4,2),
                           ACRV = "gamma",
                           variable = TRUE,
                           ACRV.ncats = 4,
                           fossil = f2)

re <- get.reconstructed(morpho_data)

Run the code above in your browser using DataLab