View source: R/daisie_data_to_tables.R
daisie_data_colonist_info_to_braching_times_table | R Documentation |
Convert the non-header part of a daisie_data
into a tabular format,
containing, for each colonist, the branching times.
This excludes the time of colonisation.
daisie_data_colonist_info_to_braching_times_table(daisie_data_colonist_info)
daisie_data_colonist_info |
an element of a |
Due to the coding of DAISIE, this is not straightforward:
If there are no colonisations, an empty table is produced
If there is one colonisation, the event_times
are used
If there are two or more colonisations, the event_times
in the all_colonisations
list is used
a table with as much rows as branching times
Richèl J.C. Bilderbeek
use daisie_data_colonist_info_to_colonisation_times_table to obtain the colonisation times of the colonists
set.seed(
1,
kind = "Mersenne-Twister",
normal.kind = "Inversion",
sample.kind = "Rejection"
)
total_time <- 1
daisie_mainland_data <- sim_island_with_mainland(
total_time = total_time,
m = 10,
island_pars = c(1, 1, 10, 0.1, 1),
mainland_ex = 1,
mainland_sample_prob = 1,
mainland_sample_type = "undiscovered",
replicates = 1,
verbose = FALSE
)
ideal_daisie_data <- daisie_mainland_data$ideal_multi_daisie_data[[1]]
# We need a non-header daisie_data
testthat::expect_true(length(ideal_daisie_data) > 1)
# Take the first non-header daisie_data
daisie_data_colonist_info <- ideal_daisie_data[[2]]
t <- daisie_data_colonist_info_to_braching_times_table(
daisie_data_colonist_info = daisie_data_colonist_info
)
testthat::expect_true("colonist_index" %in% names(t))
testthat::expect_true("branching_times" %in% names(t))
# Do not include the colonisation
testthat::expect_false(total_time %in% t$branching_times)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.