I have three csv files which looks like this:
node <- data.frame(
object = c("2-1887", "2-1887", "2-1887", "2-1887", "2-1887", "2-1887", "2-1887", "4-1889", "4-1889", "4-1889", "4-1889", "4-1889", "4-1889", "4-1889"),
id = c(1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7),
function = c("f", "r", "r", "c", "s", "r", "k", "f", "r", "s", "r", "r", "r", "t"))
edge <- data.frame(
object = c("2-1887", "2-1887", "2-1887", "2-1887", "2-1887", "2-1887", "2-1887", "4-1889", "4-1889", "4-1889", "4-1889", "4-1889", "4-1889", "4-1889"),
from = c(1, 2, 3, 3, 4, 5, 6, 1, 2, 2, 3, 4, 5, 6),
to = c(2, 3, 4, 6, 6, 6, 7, 2, 3, 4, 4, 5, 6, 7))
meta <- data.frame(
object = c("2-1887", "4-1889"),
year = c(2000, 2022))
Actually this data set contains two different graphs grouped by object
.
Is anyone who can advice how to generate two graphs grouped by object
("2-1887" and "4-1889") using tbl_graph
in ggraph/tidygraph
? It is nice if I can keep these object names in graph attributes.
I suppose I can do it with purrr
or apply
(any methods are welcomed) but I do not know appropriate data structure (list?) for further graph analyses.
I also need to add meta information (graph attributes) to each graph from an object meta
. Currently I can add graph attributes manually using such as graph$year <- 2000
but I need to automate it.
Thank you in advance for your kind support.