adayim / consort

Create CONSORT diagrams for clinical studies.
Other
28 stars 4 forks source link

add_split #9

Closed JianWang2016 closed 1 year ago

JianWang2016 commented 1 year ago

Dear Alim, Great package!

I noticed that add_split needs to have the same numbers of spitted boxes throughout, eg. The last add_split won't work. Is this intended? Thanks much.

g <- add_box(txt = c("Study 1 (n=8)", "Study 2 (n=12)")) g <- add_box(g, txt = "Included All (n=20)") g <- add_side_box(g, txt = "Excluded (n=7):\n\u2022 MRI not collected (n=3)") g <- add_box(g, txt = "Randomised") g <- add_split(g, txt = c("Arm A (n=143)", "Arm B (n=142)")) g <- add_box(g, txt = "Combine all") g <- add_split(g, txt = c("Process 1 (n=140)", "Process 2 (n=140)", "Process 3 (n=142)"))

plot(g, grViz = TRUE)

adayim commented 1 year ago

Hi Jian,

It is not an intention. Never thought anyone would want to split it again. Will try to add some flexibility to this. Thank you for pointing this out.

JianWang2016 commented 1 year ago

Thanks so much Alim for your feedback.

adayim commented 1 year ago

This is also fixed now. Try it out and let me know if it works.

g <- add_box(txt = c("Study 1 (n=8)", "Study 2 (n=12)", "Study 3 (n=12)"))
g <- add_box(g, txt = "Included All (n=20)")
g <- add_side_box(g, txt = "Excluded (n=7):\n\u2022 MRI not collected (n=3)")
g <- add_box(g, txt = "Randomised")
g <- add_split(g, txt = c("Arm A (n=143)", "Arm B (n=142)"))
g <- add_box(g, txt = c("", "From Arm B"))
g <- add_box(g, txt = "Combine all")
g <- add_split(g, txt = c("Process 1 (n=140)", "Process 2 (n=140)", "Process 3 (n=142)"))

plot(g, grViz = TRUE)
JianWang2016 commented 1 year ago

Perfect! Thanks so much.