Description Usage Arguments Details Value Examples
View source: R/get_familytree.R
get_familytree() returns all nodes even remotely connected to your input node. So not only will it return all parents, grandparents, grand grandparents, etc., children, grandchildren, grand grandchildren, etc., but also the parents, grandparents and so on for those parents and children.
1 | get_familytree(graph_dt, get_node, return_nodes = TRUE)
|
graph_dt |
data.table; A data.table with a "from" and a "to" column. See details for more. |
get_node |
character; The name of the node(s) who's family tree you want |
return_nodes |
logical; If TRUE (default) the function will return both the inputted graph_dt along with a nodes data.table. See return for more. |
The function takes as its input a data.table (graph_dt) with at least two columns called "from" and "to" and potentially many more.
It will return the inputted graph_dt data.table but only with family members included.
If return_nodes is TRUE it will also retun a data.table with node ids including a column called level showing you how many generations there are between the diffent nodes and the inputted node (get_node).
When return_nodes is TRUE it returns both data.tables in a list called nodes and edges.
1 2 3 4 5 6 7 8 9 10 11 | my_network <- data.table::data.table(
from = c("A", "A", "B", "C", "X", "Y"),
to = c("B", "C", "D", "E", "Y", "Z")
)
# -------------------------------
get_familytree(my_network, "B")
# -------------------------------
get_familytree(my_network, "X", return_nodes = FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.