From ea67bd0d6faf2898f1466f07731cbb96e9fa7d9d Mon Sep 17 00:00:00 2001 From: vedhav Date: Fri, 22 Nov 2024 17:16:24 +0530 Subject: [PATCH] feat: add refrence lines + filter unwanted data --- inst/poc_osprey.R | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/inst/poc_osprey.R b/inst/poc_osprey.R index 255969014..078b03cdc 100644 --- a/inst/poc_osprey.R +++ b/inst/poc_osprey.R @@ -7,8 +7,12 @@ data <- within(teal_data(), { library(osprey) ADSL <- osprey::rADSL |> - mutate(x_val = as.integer(TRTEDTM - TRTSDTM)) - ADRS <- osprey::rADRS + mutate(x_val = as.integer(TRTEDTM - TRTSDTM)) |> + arrange(x_val) |> + filter(!is.na(x_val)) + ADRS <- osprey::rADRS |> + filter(ADY >= 0, USUBJID %in% ADSL$USUBJID) + reference_lines <- data.frame(x = c(50, 250), xend = c(50, 250), y = min(ADSL$USUBJID), yend = max(ADSL$USUBJID)) }) join_keys(data) <- default_cdisc_join_keys[c("ADSL", "ADRS")] @@ -28,6 +32,20 @@ plotly_specs <- list( size = 10, color = "#329133" ) + ), + list( + "plotly::add_segments", + data = quote(reference_lines), + x = ~x, + xend = ~xend, + y = ~y, + yend = ~yend, + line = list( + color = "#CA0E40", + width = 2, + dash = "dash" + ), + showlegend = FALSE ) ) @@ -37,7 +55,7 @@ app <- init( teal_slice( "ADSL", "AGE", - selected = c(20, 23) + selected = c(24, 25) ), teal_slice( "ADRS",