I am trying to create a network/flow diagram that shows how drugs are connected (through clinical trials). The nodes here are the drugs, the colour of the nodes represent the type of the drug. The links connecting the nodes (drugs) represent the trials involving the drugs so links with the same colour means they are the same clinical trial.
The question I have is: would it be possible to edit the texts currently showing when you hover around the links? I would like to add the name of the study to each link and also remove the little right arrow currently showing in the label of the links since it's kind of misleading in this case to say "Drug1 => Drug2".
Here are the codes and data sets I used in the example:
library(networkD3);library(tidyverse);library(magrittr)
# dataframe with the treatments names (the nodes)
trt <- read.table("TreatmentCoding1.txt", stringsAsFactors = FALSE, header = T)
# dataframe with all the studies (the links)
datt <- read.table("Sample_Data_Pair1.txt", stringsAsFactors = FALSE, header = T)
datt %<>%
# zero-indexing the treatments in links
mutate(treat1 = treat1 - 1,
treat2 = treat2 - 1)
sankeyNetwork(Links = datt,
Source = "treat1", Target = "treat2", Value = "patient_count", LinkGroup = "study",
Nodes = trt,
NodeID = "name", NodeGroup = "drug_type", nodeWidth = 30,
fontSize = 12,
units = "patients")
Hi,
Thank you for such a great package!!
I am trying to create a network/flow diagram that shows how drugs are connected (through clinical trials). The nodes here are the drugs, the colour of the nodes represent the type of the drug. The links connecting the nodes (drugs) represent the trials involving the drugs so links with the same colour means they are the same clinical trial.
The question I have is: would it be possible to edit the texts currently showing when you hover around the links? I would like to add the name of the study to each link and also remove the little right arrow currently showing in the label of the links since it's kind of misleading in this case to say "Drug1 => Drug2".
Here are the codes and data sets I used in the example:
TreatmentCoding1.txt
Sample_Data_Pair1.txt
Thank you! Aaron