|
| 1 | +pkgload::load_all("teal") |
| 2 | +pkgload::load_all("teal.widgets") |
| 3 | +pkgload::load_all("teal.modules.general") |
| 4 | + |
| 5 | +# Example data |
| 6 | +data <- within(teal_data(), { |
| 7 | + library(dplyr) |
| 8 | + library(tidyr) |
| 9 | + ADSL <- teal.data::rADSL |> mutate( |
| 10 | + EOTSTT2 = case_when( |
| 11 | + !is.na(DCSREAS) ~ DCSREAS, |
| 12 | + TRUE ~ EOTSTT |
| 13 | + ) |
| 14 | + ) |
| 15 | + |
| 16 | + ADAE <- teal.data::rADAE |
| 17 | + ADRS <- teal.data::rADRS |
| 18 | +}) |
| 19 | + |
| 20 | +join_keys(data) <- default_cdisc_join_keys |
| 21 | + |
| 22 | +app <- init( |
| 23 | + data = data, |
| 24 | + modules = modules( |
| 25 | + tm_data_table(), |
| 26 | + tm_p_swimlane( |
| 27 | + label = "Swimlane", |
| 28 | + geom_specs = list( |
| 29 | + list( |
| 30 | + geom = quote(geom_col), |
| 31 | + data = quote(ADSL), |
| 32 | + mapping = list(y = quote(USUBJID), x = quote(EOSDY)), |
| 33 | + width = 0.2 |
| 34 | + ), # geom_col(data = synthetic_data, mapping = aes(x = subjid, x = max(study_day), width = 0.2) |
| 35 | + list( |
| 36 | + geom = quote(geom_point), |
| 37 | + data = quote(ADSL), |
| 38 | + mapping = list( |
| 39 | + y = quote(USUBJID), x = quote(EOSDY), color = quote(EOTSTT2), shape = quote(EOTSTT2) |
| 40 | + ) |
| 41 | + ), |
| 42 | + list( |
| 43 | + geom = quote(geom_point), |
| 44 | + data = quote(ADRS), |
| 45 | + mapping = list( |
| 46 | + y = quote(USUBJID), x = quote(ADY), color = quote(PARAMCD), shape = quote(PARAMCD) |
| 47 | + ) |
| 48 | + ), |
| 49 | + list( |
| 50 | + geom = quote(geom_point), |
| 51 | + data = quote(ADAE), |
| 52 | + mapping = list( |
| 53 | + y = quote(USUBJID), x = quote(ASTDY), color = quote(AETERM), shape = quote(AETERM) |
| 54 | + ) |
| 55 | + ), |
| 56 | + list( |
| 57 | + geom = quote(geom_point), |
| 58 | + data = quote(ADAE), |
| 59 | + mapping = list( |
| 60 | + y = quote(USUBJID), x = quote(AENDY), color = quote(AEOUT), shape = quote(AEOUT) |
| 61 | + ) |
| 62 | + ) |
| 63 | + ), |
| 64 | + title = "Swimlane Efficacy Plot" |
| 65 | + ) |
| 66 | + ) |
| 67 | +) |
| 68 | + |
| 69 | +shinyApp(app$ui, app$server) |
0 commit comments