Skip to content

Conversation

vedhav
Copy link
Contributor

@vedhav vedhav commented Mar 19, 2024

Part of the PR #207

Triggering the reactivity using observeEvent

Example to test:

pkgload::load_all("../teal.modules.general")
pkgload::load_all("../teal.transform")
pkgload::load_all("../teal")
pkgload::load_all("../teal.widgets")

data <- teal_data()
data <- within(data, {
  require(nestcolor)
  ADSL <- rADSL
  ADSL$SEX2 <- rADSL$SEX
})
datanames(data) <- "ADSL"
join_keys(data) <- default_cdisc_join_keys[datanames(data)]

app <- init(
  data = data,
  modules = modules(
    tm_g_association(
      ref = data_extract_spec(
        dataname = "ADSL",
        filter = filter_spec(vars = choices_selected(variable_choices("ADSL"), "SEX")),
        select = select_spec(
          label = "Select variable:",
          choices = variable_choices(
            data[["ADSL"]],
            c("SEX", "RACE", "COUNTRY", "ARM", "STRATA1", "STRATA2", "ITTFL", "BMRKR2")
          ),
          selected = "RACE",
          fixed = FALSE
        )
      ),
      vars = data_extract_spec(
        dataname = "ADSL",
        select = select_spec(
          label = "Select variables:",
          choices = variable_choices(
            data[["ADSL"]],
            c("SEX", "RACE", "COUNTRY", "ARM", "STRATA1", "STRATA2", "ITTFL", "BMRKR2")
          ),
          selected = "BMRKR2",
          multiple = TRUE,
          fixed = FALSE
        )
      ),
      ggplot2_args = ggplot2_args(
        labs = list(subtitle = "Plot generated by Association Module")
      )
    )
  )
)

shinyApp(app$ui, app$server)

@vedhav vedhav added the core label Mar 19, 2024
@vedhav vedhav requested review from chlebowa and gogonzo and removed request for chlebowa March 19, 2024 14:50
Copy link
Contributor

@chlebowa chlebowa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicely done 👍

@chlebowa chlebowa merged commit 578e847 into 898_save_app_state3@main Mar 19, 2024
@chlebowa chlebowa deleted the triggering_vals_on_col@898_save_app_state3@main branch March 19, 2024 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants