Sankey Diagram - Response over time by two treatment groups

I have response status data for each subject at W14, 24, 36, and 52.
I would like to create Sankey Diagram for two treatment groups: Act and PBO.
Response Status at each timepoint is: CR, PR, SD, PD.
Below is my sample code. I have several questions:

  1. Do I have to use different levels of response status: CR1, CR2, CR3, CR4 for four timepoints? I tried to use only CR, PR, SD, PD, but the output looks weird.
  2. Could I have the order for each timepoint as: CR, PR, SD, and PD.
  3. Could I put two treatment groups in one Sankey diagram instead of two separately?

trt<-sample(x=c("Act","PBO"), size=81, replace=TRUE)
w14<-sample(x=c("CR1","PR1","SD1","PD1"), size=81, replace=TRUE)
w24<-sample(x=c("CR2","PR2","SD2","PD2"), size=81, replace=TRUE)
w36<-sample(x=c("CR3","PR3","SD3","PD3"), size=81, replace=TRUE)
w52<-sample(x=c("CR4","PR4","SD4","PD4"), size=81, replace=TRUE)

d<-data.frame(cbind(trt,w14,w24,w36,w52))
d.Act<-d[d$trt=='Act',]
d.PBO<-d[d$trt=='PBO',]
d.Act1<-d.Act[,-1]
d.PBO1<-d.PBO[,-1]
hchart(data_to_sankey(d.Act1), "sankey", name = "Reponse over time")
hchart(data_to_sankey(d.PBO1), "sankey", name = "Reponse over time")

Thanks all,

Kate

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.