I want to alter the Sankey plot I made using networkD3 R package so that multiple links flow from one node, here is what I did so far:
header of random sample of data:
Study Category Class
<chr> <chr> <chr>
1 study17 cat H class B;class C
2 study32 cat A;cat B class A
3 study7 cat F class A
4 study21 cat F class C
5 study24 cat F class B;class C
6 study15 cat E;cat K class C
# example data
d <- read.csv(text = "Study,Category,Class
study17,cat H,class B;class C
study32,cat A;cat B,class A
study7,cat F,class A
study21,cat F,class C
study24,cat F,class B;class C
study15,cat E;cat K,class C")
Using this answer I created the following sankeyplot:
However, as you can tell, the second and third columns now include "composite nodes" such as "cat A;cat B" and "class B; class C".
I would like to make it such that 2 nodes flow from study 32: one to cat A and one to cat B. Similarly, I would like two nodes flowing from cat F (row5): one to class B and one to class C.
In essence, I am asking if something like link splitting is possible? I know I could just split them regularly and create a new row for each instance, but this would distort the truth in this image..