
Extract spatio-temporal edge annotation table from a given tree or tree sequence
Source:R/tree-sequences.R
ts_edges.Rd
Extract spatio-temporal edge annotation table from a given tree or tree sequence
Arguments
- x
Tree object generated by
ts_phylo
or a slendr tree sequence object produced byts_load
,ts_recapitate
,ts_simplify
, orts_mutate
Value
Data frame of the sf
type containing the times of nodes and
start-end coordinates of edges across space
Examples
check_dependencies(python = TRUE) # make sure dependencies are present
init_env()
#> The interface to all required Python modules has been activated.
# load an example model with an already simulated tree sequence
slendr_ts <- system.file("extdata/models/introgression.trees", package = "slendr")
model <- read_model(path = system.file("extdata/models/introgression", package = "slendr"))
# load the tree-sequence object from disk
ts <- ts_load(slendr_ts, model, simplify = TRUE)
# extract an annotated table with (spatio-)temporal edge information
ts_edges(ts)
#> # A tibble: 133 × 6
#> child_node_id parent_node_id child_time parent_time child_pop parent_pop
#> <int> <int> <dbl> <dbl> <fct> <fct>
#> 1 14 26 0 20 CH CH
#> 2 15 26 0 20 CH CH
#> 3 4 36 0 1430 AFR AFR
#> 4 5 30 0 80 AFR AFR
#> 5 6 27 0 20 AFR AFR
#> 6 7 28 0 20 AFR AFR
#> 7 8 28 0 20 AFR AFR
#> 8 9 31 0 110 AFR AFR
#> 9 10 32 0 140 AFR AFR
#> 10 11 29 0 50 AFR AFR
#> # … with 123 more rows