
Extract spatio-temporal edge annotation table from a given tree or tree sequence
Source:R/tree-sequences.R
ts_edges.RdExtract spatio-temporal edge annotation table from a given tree or tree sequence
Value
Data frame of the sf type containing the times of nodes and
start-end coordinates of edges across space
Examples
init_env()
#> Python virtual environment for slendr has been activated.
# load an example model with an already simulated tree sequence
slendr_ts <- system.file("extdata/models/introgression_slim.trees", package = "slendr")
model <- read_model(path = system.file("extdata/models/introgression", package = "slendr"))
# load the tree-sequence object from disk
ts <- ts_read(slendr_ts, model)
# extract an annotated table with (spatio-)temporal edge information
ts_edges(ts)
#> # A tibble: 258 × 6
#> child_node_id parent_node_id child_time parent_time child_pop parent_pop
#> <int> <int> <dbl> <dbl> <fct> <fct>
#> 1 0 76 70000 70160 NEA NEA
#> 2 1 76 70000 70160 NEA NEA
#> 3 2 56 40000 40580 NEA NEA
#> 4 3 56 40000 40580 NEA NEA
#> 5 4 26 0 20 AFR AFR
#> 6 5 26 0 20 AFR AFR
#> 7 6 28 0 80 AFR AFR
#> 8 7 27 0 50 AFR AFR
#> 9 8 32 0 500 AFR AFR
#> 10 8 31 0 440 AFR AFR
#> # ℹ 248 more rows