ts_table {slendr} | R Documentation |
Get the table of individuals/nodes/edges/mutations from the tree sequence
Description
This function extracts data from a given tree sequence table. All times are converted to model-specific time units from tskit's "generations backwards" time direction.
Usage
ts_table(ts, table = c("individuals", "edges", "nodes", "mutations"))
Arguments
ts |
Tree sequence object of the class |
table |
Which tree sequence table to return |
Details
For further processing and analyses, the output of the function
ts_nodes
might be more useful, as it merges the information in
node and individual tables into one table and further annotates it with
useful information from the model configuration data.
Value
Data frame with the information from the give tree-sequence table (can be either a table of individuals, edges, nodes, or mutations).
See Also
ts_nodes
and ts_edges
for accessing an
annotated, more user-friendly and analysis-friendly tree-sequence table
data
Examples
# 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 and add mutations to it
ts <- ts_load(slendr_ts, model) %>% ts_mutate(mutation_rate = 1e-8, random_seed = 42)
# get the 'raw' tskit table of individuals
ts_table(ts, "individuals")
# get the 'raw' tskit table of edges
ts_table(ts, "edges")
# get the 'raw' tskit table of nodes
ts_table(ts, "nodes")
# get the 'raw' tskit table of mutations
ts_table(ts, "mutations")
[Package slendr version 0.9.1 Index]