@@ -2,7 +2,8 @@ pkgload::load_all("teal")
22pkgload :: load_all(" teal.widgets" )
33pkgload :: load_all(" teal.modules.general" )
44
5- # Example data
5+ # Note: Please add the `PATH_TO_DATA` and change the X, Y, and Z Administrations to the actual values in the data
6+
67data <- within(teal_data(), {
78 library(dplyr )
89 library(arrow )
@@ -32,79 +33,49 @@ data <- within(teal_data(), {
3233 summarise(max_study_day = max(event_study_day ))
3334})
3435
35- color_manual <- c(
36- " DEATH" = " black" ,
37- " WITHDRAWAL BY SUBJECT" = " grey" ,
38- " PD (Progressive Disease)" = " red" ,
39- " SD (Stable Disease)" = " darkorchid4" ,
40- " MR (Minimal/Minor Response)" = " sienna4" ,
41- " PR (Partial Response)" = " maroon" ,
42- " VGPR (Very Good Partial Response)" = " chartreuse4" ,
43- " CR (Complete Response)" = " #3a41fc" ,
44- " SCR (Stringent Complete Response)" = " midnightblue"
45- )
46- shape_manual <- c(
47- " DEATH" = 4 ,
48- " WITHDRAWAL BY SUBJECT" = 5 ,
49- " PD (Progressive Disease)" = 8 ,
50- " SD (Stable Disease)" = 5 ,
51- " MR (Minimal/Minor Response)" = 5 ,
52- " PR (Partial Response)" = 5 ,
53- " VGPR (Very Good Partial Response)" = 5 ,
54- " CR (Complete Response)" = 5 ,
55- " SCR (Stringent Complete Response)" = 5
36+ plotly_specs <- list (
37+ list (" plotly::add_markers" , x = ~ study_day , y = ~ subject , color = ~ catagory , symbol = ~ catagory , data = quote(study_drug_administration )),
38+ list (" plotly::add_markers" , x = ~ study_day , y = ~ subject , color = ~ catagory , symbol = ~ catagory , data = quote(response_assessment )),
39+ list (" plotly::add_markers" , x = ~ study_day , y = ~ subject , color = ~ catagory , symbol = ~ catagory , data = quote(disposition )),
40+ list (" plotly::add_bars" , x = ~ max_study_day , y = ~ subject , data = quote(max_subject_day ), width = 0.1 , marker = list (color = " grey" ), showlegend = FALSE )
5641)
5742
5843app <- init(
5944 data = data ,
6045 modules = modules(
6146 tm_data_table(),
62- tm_p_swimlane (
47+ tm_p_swimlane2 (
6348 label = " Swimlane" ,
64- geom_specs = list (
65- list (
66- geom = str2lang(" ggplot2::geom_bar" ),
67- data = quote(max_subject_day ),
68- mapping = list (y = quote(subject ), x = quote(max_study_day )),
69- stat = " identity" ,
70- width = 0.1
71- ),
72- list (
73- geom = quote(geom_point ),
74- data = quote(study_drug_administration ),
75- mapping = list (
76- y = quote(subject ), x = quote(study_day ), color = quote(catagory ), shape = quote(catagory )
77- )
78- ),
79- list (
80- geom = quote(geom_point ),
81- data = quote(disposition ),
82- mapping = list (
83- y = quote(subject ), x = quote(study_day ), color = quote(catagory ), shape = quote(catagory )
84- )
85- ),
86- list (
87- geom = quote(geom_point ),
88- data = quote(response_assessment ),
89- mapping = list (
90- y = quote(subject ), x = quote(study_day ), color = quote(catagory ), shape = quote(catagory )
91- )
92- ),
93- list (
94- geom = quote(scale_color_manual ),
95- values = color_manual ,
96- breaks = names(color_manual )
97- ),
98- list (
99- geom = quote(scale_shape_manual ),
100- values = shape_manual ,
101- breaks = names(shape_manual )
102- ),
103- list (
104- geom = quote(theme_minimal )
105- )
49+ plotly_specs = plotly_specs ,
50+ title = " Swimlane Efficacy Plot" ,
51+ colors = c(
52+ " DEATH" = " black" ,
53+ " WITHDRAWAL BY SUBJECT" = " grey" ,
54+ " PD (Progressive Disease)" = " red" ,
55+ " SD (Stable Disease)" = " darkorchid4" ,
56+ " MR (Minimal/Minor Response)" = " sienna4" ,
57+ " PR (Partial Response)" = " maroon" ,
58+ " VGPR (Very Good Partial Response)" = " chartreuse4" ,
59+ " CR (Complete Response)" = " #3a41fc" ,
60+ " SCR (Stringent Complete Response)" = " midnightblue" ,
61+ " X Administration Injection" = " goldenrod" ,
62+ " Y Administration Infusion" = " deepskyblue3" ,
63+ " Z Administration Infusion" = " darkorchid"
10664 ),
107- title = " Swimlane Efficacy Plot"
65+ symbols = c(
66+ " DEATH" = " circle" ,
67+ " WITHDRAWAL BY SUBJECT" = " square" ,
68+ " PD (Progressive Disease)" = " circle" ,
69+ " SD (Stable Disease)" = " square-open" ,
70+ " MR (Minimal/Minor Response)" = " star-open" ,
71+ " PR (Partial Response)" = " star-open" ,
72+ " VGPR (Very Good Partial Response)" = " star-open" ,
73+ " CR (Complete Response)" = " star-open" ,
74+ " SCR (Stringent Complete Response)" = " star-open" ,
75+ " X Administration Injection" = " line-ns-open" ,
76+ " Y Administration Infusion" = " line-ns-open" ,
77+ " Z Administration Infusion" = " line-ns-open"
78+ )
10879 )
10980 )
11081)
0 commit comments