ts_nodes | R Documentation |
This function combines information from the table of individuals and table of nodes into a single data frame which can be used in downstream analyses.
ts_nodes(x, sf = TRUE)
x |
Tree sequence object of the class |
sf |
Should spatial data be returned in an sf format? If |
The source of data (tables of individuals and nodes recorded in the tree
sequence generated by SLiM) are combined into a single data frame. If the
model which generated the data was spatial, coordinates of nodes (which are
pixel-based by default because SLiM spatial simulations occur on a raster),
the coordinates are automatically converted to an explicit spatial object of
the sf
class unless spatial = FALSE
. See
https://r-spatial.github.io/sf/ for an extensive introduction to the sf
package and the ways in which spatial data can be processed, analysed, and
visualised.
Data frame with processed information from the tree sequence object.
If the model which generated this data was spatial, result will be returned
as a spatial object of the class sf
.
ts_table
for accessing raw tree sequence tables
without added metadata annotation. See also ts_ancestors
to
learn how to extract information about relationship beteween nodes in the
tree sequence, and how to analysed data about distances between nodes in
the spatial context.
init_env()
# 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 node information
ts_nodes(ts)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.