Question

I have the data like below to be visualized

Col1  Col2
o1     i1
o1     i2
o1     i3
o2     i1
i1     i9
i1     i5

I wanted the output to be a graph which would show me how each element in "Col1" is related to each element in "Col2"

For example, 1) o1 --> i1 --> i9
2) o1 --> i1 --> i5 Is there some kind of network graph in R which I can readily make use of.

Thanks

Was it helpful?

Solution

For example like this:

df <- read.table(sep=" ", header=TRUE, text="
Col1 Col2
o1 i1
o1 i2
o1 i3
o2 i1
i1 i9
i1 i5")
require(igraph)
plot(graph.edgelist(as.matrix(df)))

enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top