Skip to content

Commit ea67bd0

Browse files
committed
feat: add refrence lines + filter unwanted data
1 parent 21eff43 commit ea67bd0

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

inst/poc_osprey.R

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,12 @@ data <- within(teal_data(), {
77
library(osprey)
88

99
ADSL <- osprey::rADSL |>
10-
mutate(x_val = as.integer(TRTEDTM - TRTSDTM))
11-
ADRS <- osprey::rADRS
10+
mutate(x_val = as.integer(TRTEDTM - TRTSDTM)) |>
11+
arrange(x_val) |>
12+
filter(!is.na(x_val))
13+
ADRS <- osprey::rADRS |>
14+
filter(ADY >= 0, USUBJID %in% ADSL$USUBJID)
15+
reference_lines <- data.frame(x = c(50, 250), xend = c(50, 250), y = min(ADSL$USUBJID), yend = max(ADSL$USUBJID))
1216
})
1317

1418
join_keys(data) <- default_cdisc_join_keys[c("ADSL", "ADRS")]
@@ -28,6 +32,20 @@ plotly_specs <- list(
2832
size = 10,
2933
color = "#329133"
3034
)
35+
),
36+
list(
37+
"plotly::add_segments",
38+
data = quote(reference_lines),
39+
x = ~x,
40+
xend = ~xend,
41+
y = ~y,
42+
yend = ~yend,
43+
line = list(
44+
color = "#CA0E40",
45+
width = 2,
46+
dash = "dash"
47+
),
48+
showlegend = FALSE
3149
)
3250
)
3351

@@ -37,7 +55,7 @@ app <- init(
3755
teal_slice(
3856
"ADSL",
3957
"AGE",
40-
selected = c(20, 23)
58+
selected = c(24, 25)
4159
),
4260
teal_slice(
4361
"ADRS",

0 commit comments

Comments
 (0)