teal.gallery icon indicating copy to clipboard operation
teal.gallery copied to clipboard

[Question]: Exploratory data review app module

Open probert7-git2 opened this issue 8 months ago • 4 comments

What is your question?

The teal exploratory data review app code i'm running has the app come up but there is no data. I needed to move the library statements outside of the within statement. Would this cause the data to not be passed to the shiny app?

Code of Conduct

  • [x] I agree to follow this project's Code of Conduct.

Contribution Guidelines

  • [x] I agree to follow this project's Contribution Guidelines.

Security Policy

  • [x] I agree to follow this project's Security Policy.

probert7-git2 avatar Apr 28 '25 01:04 probert7-git2

Hi @probert7-git2 Please provide screenshot and code so we can reproduce your issue

donyunardi avatar May 08 '25 23:05 donyunardi

This code generates a display but it seems that it is instantiated with no incoming data.

# Safety Data Review App from Git Hub Imageengineering



# install.packages("pak")

pak::pak("insightsengineering/teal")



install.packages(“teal.modules.clinical”)

install.packages(“teal.modules.general”)

#install.packages(“random.cdisc.data”)



  library(teal.modules.general)

  library(teal.modules.clinical)

  library(random.cdisc.data)

  library(dplyr)

  library(tidyr)

  library(ggExtra)

  library(ggpmisc)

  library(ggpp)

  library(goftest)

  library(gridExtra)

  library(htmlwidgets)

  library(jsonlite)

  library(lattice)

  library(MASS)

  library(rlang)

  library(rtables)

  library(nestcolor)

  library(broom)

  library(colourpicker)

  library(sparkline)

options(

  shiny.useragg = FALSE,

  teal.ggplot2_args = teal.widgets::ggplot2_args(labs = list(caption =
"NEST PROJECT"))

)



  ADSL <- radsl(seed = 1)

  ADRS <- radrs(ADSL, seed = 1)

  ADLB <- radlb(ADSL, seed = 1)

  ADLBPCA <- ADLB %>%

    dplyr::select(USUBJID, STUDYID, SEX, ARMCD, AVAL, AVISIT, PARAMCD) %>%

    tidyr::pivot_wider(

      values_from = "AVAL",

      names_from = c("PARAMCD", "AVISIT"),

      names_sep = " - "

    )





# Data reproducible code ----

#data <- teal_data()

#data <- within(data, {

#  ADSL <- ADSL

#  ADRS <- ADRS

# ADLB <- ADLB

#  ADLBPCA <- ADLBPCA

#   })



data <- teal_data(

ADSL = ADSL,

ADRS = ADRS,

ADLB = ADLB,

ADLBPCA = ADLBPCA )



#the default_cdisc_join_keys cannot also include ADLBPCA which has no CDISC
metadata

join_keys(data) <- default_cdisc_join_keys[c("ADSL",  "ADLB", "ADRS")]



## Reusable Configuration For Modules

ADSL <- data[["ADSL"]]

ADRS <- data[["ADRS"]]

ADLB <- data[["ADLB"]]

ADLBPCA <- data[["ADLBPCA"]]









adsl_extracted_num <- data_extract_spec(

  dataname = "ADSL",

  select = select_spec(

    choices = variable_choices(ADSL),

    selected = "AGE",

    multiple = FALSE,

    fixed = FALSE

  )

)

adsl_extracted_num2 <- data_extract_spec(

  dataname = "ADSL",

  select = select_spec(

    choices = variable_choices(ADSL),

    selected = "BMRKR1",

    multiple = FALSE,

    fixed = FALSE

  )

)

adsl_extracted_fct <- data_extract_spec(

  dataname = "ADSL",

  select = select_spec(

    choices = variable_choices(ADSL),

    selected = "ARMCD",

    multiple = FALSE,

    fixed = FALSE

  )

)



numeric_vars_adsl <- names(Filter(isTRUE, sapply(ADSL, is.numeric)))



adsl_extracted_numeric <- data_extract_spec(

  dataname = "ADSL",

  select = select_spec(

    choices = variable_choices(ADSL, subset = numeric_vars_adsl),

    selected = "BMRKR1",

    multiple = FALSE,

    fixed = FALSE

  )

)

adsl_extracted_factors <- data_extract_spec(

  dataname = "ADSL",

  select = select_spec(

    choices = variable_choices(ADSL, subset = fact_vars_adsl),

    selected = NULL,

    multiple = FALSE,

    fixed = FALSE

  )

)



adsl_extracted_multi <- data_extract_spec(

  dataname = "ADSL",

  select = select_spec(

    choices = variable_choices(ADSL),

    selected = c("AGE", "BMRKR1"),

    multiple = TRUE,

    fixed = FALSE

  )

)



adrs_filters <- filter_spec(

  vars = "PARAMCD",

  sep = " - ",

  choices = value_choices(ADRS, "PARAMCD", "PARAM", c("BESRSPI", "INVET")),

  selected = "BESRSPI",

  multiple = FALSE,

  label = "Choose endpoint"

)



adrs_extracted_response <- data_extract_spec(

  dataname = "ADRS",

  filter = adrs_filters,

  select = select_spec(

    choices = variable_choices(ADRS, c("AVALC", "AVAL")),

    selected = "AVALC",

    multiple = FALSE,

    fixed = FALSE

  )

)



fact_vars_adrs <- names(Filter(isTRUE, sapply(ADRS, is.factor)))



adrs_extracted_response_fct <- data_extract_spec(

  dataname = "ADRS",

  filter = adrs_filters,

  select = select_spec(

    choices = variable_choices(ADRS, subset = fact_vars_adrs),

    selected = "AVALC",

    multiple = FALSE,

    fixed = FALSE

  )

)



adlb_filter_paramcd <- filter_spec(

  vars = "PARAMCD",

  choices = value_choices(ADLB, "PARAMCD", "PARAM"),

  selected = levels(ADLB$PARAMCD)[1],

  multiple = FALSE,

  label = "Select lab:"

)

adlb_filter_paramcd2 <- filter_spec(

  vars = "PARAMCD",

  choices = value_choices(ADLB, "PARAMCD", "PARAM"),

  selected = levels(ADLB$PARAMCD)[2],

  multiple = FALSE,

  label = "Select lab:"

)

adlb_filter_visit <- filter_spec(

  vars = "AVISIT",

  choices = levels(ADLB$AVISIT),

  selected = levels(ADLB$AVISIT)[1],

  multiple = FALSE,

  label = "Select visit:"

)

adlb_extracted_aval <- data_extract_spec(

  dataname = "ADLB",

  select = select_spec(

    choices = variable_choices(ADLB, c("AVAL", "CHG", "PCHG", "ANRIND",
"BASE")),

    selected = "AVAL",

    multiple = FALSE,

    fixed = FALSE

  ),

  filter = list(

    adlb_filter_paramcd,

    adlb_filter_visit

  )

)



numeric_vars_adlbpca <- names(Filter(isTRUE, sapply(ADLBPCA, is.numeric)))



distr_filter_spec <- filter_spec(

  vars = choices_selected(

    variable_choices(ADSL, fact_vars_adsl),

    selected = NULL

  ),

  multiple = TRUE

)



## App header and footer ----

nest_logo <- "
https://raw.githubusercontent.com/insightsengineering/hex-stickers/main/PNG/nest.png
"

app_source <- "
https://github.com/insightsengineering/teal.gallery/tree/main/exploratory"

gh_issues_page <- "
https://github.com/insightsengineering/teal.gallery/issues"



header <- tags$span(

  style = "display: flex; align-items: center; justify-content:
space-between; margin: 10px 0 10px 0;",

  tags$span("My first teal app", style = "font-size: 30px;"),

  tags$span(

    style = "display: flex; align-items: center;",

    tags$img(src = nest_logo, alt = "NEST logo", height = "45px", style =
"margin-right:10px;"),

    tags$span(style = "font-size: 24px;", "NEST @ Roche")

  )

)



footer <- tags$p(

  "This teal app is brought to you by the NEST Team at Roche/Genentech.

        For more information, please visit:",

  tags$a(href = app_source, target = "_blank", "Source Code"), ", ",

  tags$a(href = gh_issues_page, target = "_blank", "Report Issues")

)



# Add before module definitions

fact_vars_adsl <- names(Filter(is.factor, ADSL))

numeric_vars_adsl <- names(Filter(is.numeric, ADSL))



adsl_extracted_fct2 <- data_extract_spec(

    dataname = "ADSL",

    select = select_spec(

        choices = variable_choices(ADSL, subset = fact_vars_adsl),

        selected = fact_vars_adsl[1],

        multiple = FALSE,

        fixed = FALSE

    )

)



adsl_extracted_fct3 <- adsl_extracted_fct2  # Replace with proper
definition if needed

app <- init(

  data = data,

  filter = teal_slices(

    count_type = "all",

    teal_slice(dataname = "ADSL", varname = "SEX"),

    teal_slice(dataname = "ADSL", varname = "AGE")

  ),

  modules = modules(

    teal.modules.general::tm_front_page(

      label = "App Info",

      header_text = c(

        "Info about input data source" =

          "This app uses CDISC ADaM datasets randomly generated by
`random.cdisc.data` R packages"

      ),

      tables = list(

        `NEST packages used in this demo app` = data.frame(Packages =
c("teal.modules.general", "random.cdisc.data"))

      )

    ),

    teal.modules.general::tm_file_viewer(

      label = "File viewer",

      input_path = list(

        png = "https://www.r-project.org/logo/Rlogo.png",

        Rmd = "
https://raw.githubusercontent.com/tidyverse/dplyr/master/README.Rmd",

        pdf = "
https://cran.r-project.org/web/packages/shinyTree/shinyTree.pdf"

      )

    ),

    teal.modules.general::tm_data_table("Data Table"),

    teal.modules.general::tm_variable_browser("Variable Browser"),

    teal.modules.general::tm_missing_data("Missing Data"),

    teal.modules.general::tm_g_distribution(

      "Distribution",

      dist_var = adsl_extracted_numeric,

      strata_var = data_extract_spec(

        dataname = "ADSL",

        filter = distr_filter_spec

      ),

      group_var = data_extract_spec(

        dataname = "ADSL",

        filter = distr_filter_spec

      )

    ),

    teal.modules.general::tm_outliers(

      "Outliers",

      outlier_var = data_extract_spec(

        dataname = "ADLB",

        select = select_spec(

          choices = variable_choices(ADLB, c("AVAL", "CHG", "PCHG",
"BASE")),

          selected = "AVAL",

          multiple = FALSE,

          fixed = FALSE

        )

      ),

      categorical_var = data_extract_spec(

        dataname = "ADLB",

        select = select_spec(

          choices = variable_choices(ADLB, c("PARAM", "PARAMCD")),

          selected = NULL,

          multiple = FALSE,

          fixed = FALSE

        )

      )

    ),

    teal.modules.general::tm_g_association(

      ref = adsl_extracted_num,

      vars = adsl_extracted_fct3

    ),

    teal.modules.general::tm_g_bivariate(

      x = adsl_extracted_num,

      y = adlb_extracted_aval,

      row_facet = adsl_extracted_factors,

      col_facet = adsl_extracted_factors,

      use_density = FALSE,

      plot_height = c(600L, 200L, 2000L),

      ggtheme = "gray"

    ),

    teal.modules.general::tm_a_regression(

      label = "Regression",

      response = adsl_extracted_numeric,

      regressor = adrs_extracted_response

    ),

    teal.modules.general::tm_g_response(

      response = adrs_extracted_response_fct,

      x = adsl_extracted_fct2,

      row_facet = adsl_extracted_factors,

      col_facet = adsl_extracted_factors,

      coord_flip = FALSE

    ),

    teal.modules.general::tm_g_scatterplotmatrix(

      label = "Scatterplot matrix",

      variables = adsl_extracted_multi

    ),

    teal.modules.general::tm_g_scatterplot(

      "Scatterplot",

      x = adsl_extracted_num,

      y = adsl_extracted_num2,

      row_facet = adsl_extracted_factors,

      col_facet = adsl_extracted_factors,

      color_by = adsl_extracted_factors,

      size = 3, alpha = 1,

      plot_height = c(600L, 200L, 2000L)

    ),

    teal.modules.general::tm_t_crosstable(

      "Table Choices",

      x = adsl_extracted_fct2,

      y = adsl_extracted_fct

    ),

    teal.modules.general::tm_a_pca(

      "Principal Component Analysis",

      dat = data_extract_spec(

        dataname = "ADLBPCA",

        select = select_spec(

          choices = variable_choices(ADLBPCA, numeric_vars_adlbpca),

          selected = c("ALT - WEEK 5 DAY 36", "CRP - WEEK 5 DAY 36", "IGA -
WEEK 5 DAY 36"),

          multiple = TRUE,

          fixed = FALSE,

          label = "Variable"

        ),

      ),

      plot_height = c(600L, 200L, 2000L),

      plot_width = c(600L, 200L, 2000L)

    )

  )

) |>

  modify_title(

    title = "Exploratory Analysis Teal Demo App",

    favicon = nest_logo

  ) |>

  modify_header(header) |>

  modify_footer(footer)



shinyApp(app$ui, app$server)

On Thu, May 8, 2025 at 4:05 PM Dony Unardi @.***> wrote:

donyunardi left a comment (insightsengineering/teal.gallery#202) https://github.com/insightsengineering/teal.gallery/issues/202#issuecomment-2864644186

Hi @probert7-git2 https://github.com/probert7-git2 Please provide screenshot and code so we can reproduce your issue

— Reply to this email directly, view it on GitHub https://github.com/insightsengineering/teal.gallery/issues/202#issuecomment-2864644186, or unsubscribe https://github.com/notifications/unsubscribe-auth/BQH2MY4RCC6IVZ7Y43RKHYD25PPM7AVCNFSM6AAAAAB37HFFAGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQNRUGY2DIMJYGY . You are receiving this because you were mentioned.Message ID: @.***>

probert7-git2 avatar May 12 '25 22:05 probert7-git2

You don't need to put the library outside of the within() statement. If you don't see any data, then maybe there's something wrong with how the teal_data() was constructed.

The code that you provided is very similar with the exploratory app code from teal.gallery, with a little update. However, I can't reproduce your issue because I ran into this error message: "Error: object 'fact_vars_adsl' not found". It appears that you moved the creation of this object later in the code when it's needed in the beginning. Can you please check this? I need reproducible code so I can understand your problem. Also, please provide screenshot and sessionInfo() so we can help you better.

donyunardi avatar May 12 '25 23:05 donyunardi

@donyunardi I think you can run

fact_vars_adsl <- names(Filter(is.factor, ADSL))

just after data creation

m7pr avatar May 13 '25 09:05 m7pr

Thanks,

Then I can see the data just fine. @probert7-git2 please follow @m7pr suggestion.

Image
Code
# Safety Data Review App from Git Hub Imageengineering



# install.packages("pak")

# pak::pak("insightsengineering/teal")
# 
# 
# 
# install.packages(“teal.modules.clinical”)
# 
# install.packages(“teal.modules.general”)

#install.packages(“random.cdisc.data”)



library(teal.modules.general)

library(teal.modules.clinical)

library(random.cdisc.data)

library(dplyr)

library(tidyr)

library(ggExtra)

library(ggpmisc)

library(ggpp)

library(goftest)

library(gridExtra)

library(htmlwidgets)

library(jsonlite)

library(lattice)

library(MASS)

library(rlang)

library(rtables)

library(nestcolor)

library(broom)

library(colourpicker)

library(sparkline)

options(
  
  shiny.useragg = FALSE,
  
  teal.ggplot2_args = teal.widgets::ggplot2_args(labs = list(caption =
                                                               "NEST PROJECT"))
  
)



ADSL <- radsl(seed = 1)

ADRS <- radrs(ADSL, seed = 1)

ADLB <- radlb(ADSL, seed = 1)

ADLBPCA <- ADLB %>%
  
  dplyr::select(USUBJID, STUDYID, SEX, ARMCD, AVAL, AVISIT, PARAMCD) %>%
  
  tidyr::pivot_wider(
    
    values_from = "AVAL",
    
    names_from = c("PARAMCD", "AVISIT"),
    
    names_sep = " - "
    
  )





# Data reproducible code ----

#data <- teal_data()

#data <- within(data, {

#  ADSL <- ADSL

#  ADRS <- ADRS

# ADLB <- ADLB

#  ADLBPCA <- ADLBPCA

#   })



data <- teal_data(
  
  ADSL = ADSL,
  
  ADRS = ADRS,
  
  ADLB = ADLB,
  
  ADLBPCA = ADLBPCA )



#the default_cdisc_join_keys cannot also include ADLBPCA which has no CDISC
# metadata

join_keys(data) <- default_cdisc_join_keys[c("ADSL",  "ADLB", "ADRS")]



## Reusable Configuration For Modules

ADSL <- data[["ADSL"]]

ADRS <- data[["ADRS"]]

ADLB <- data[["ADLB"]]

ADLBPCA <- data[["ADLBPCA"]]









adsl_extracted_num <- data_extract_spec(
  
  dataname = "ADSL",
  
  select = select_spec(
    
    choices = variable_choices(ADSL),
    
    selected = "AGE",
    
    multiple = FALSE,
    
    fixed = FALSE
    
  )
  
)

adsl_extracted_num2 <- data_extract_spec(
  
  dataname = "ADSL",
  
  select = select_spec(
    
    choices = variable_choices(ADSL),
    
    selected = "BMRKR1",
    
    multiple = FALSE,
    
    fixed = FALSE
    
  )
  
)

adsl_extracted_fct <- data_extract_spec(
  
  dataname = "ADSL",
  
  select = select_spec(
    
    choices = variable_choices(ADSL),
    
    selected = "ARMCD",
    
    multiple = FALSE,
    
    fixed = FALSE
    
  )
  
)


fact_vars_adsl <- names(Filter(is.factor, ADSL))

# numeric_vars_adsl <- names(Filter(is.numeric, ADSL))
numeric_vars_adsl <- names(Filter(isTRUE, sapply(ADSL, is.numeric)))



adsl_extracted_numeric <- data_extract_spec(
  
  dataname = "ADSL",
  
  select = select_spec(
    
    choices = variable_choices(ADSL, subset = numeric_vars_adsl),
    
    selected = "BMRKR1",
    
    multiple = FALSE,
    
    fixed = FALSE
    
  )
  
)

adsl_extracted_factors <- data_extract_spec(
  
  dataname = "ADSL",
  
  select = select_spec(
    
    choices = variable_choices(ADSL, subset = fact_vars_adsl),
    
    selected = NULL,
    
    multiple = FALSE,
    
    fixed = FALSE
    
  )
  
)



adsl_extracted_multi <- data_extract_spec(
  
  dataname = "ADSL",
  
  select = select_spec(
    
    choices = variable_choices(ADSL),
    
    selected = c("AGE", "BMRKR1"),
    
    multiple = TRUE,
    
    fixed = FALSE
    
  )
  
)



adrs_filters <- filter_spec(
  
  vars = "PARAMCD",
  
  sep = " - ",
  
  choices = value_choices(ADRS, "PARAMCD", "PARAM", c("BESRSPI", "INVET")),
  
  selected = "BESRSPI",
  
  multiple = FALSE,
  
  label = "Choose endpoint"
  
)



adrs_extracted_response <- data_extract_spec(
  
  dataname = "ADRS",
  
  filter = adrs_filters,
  
  select = select_spec(
    
    choices = variable_choices(ADRS, c("AVALC", "AVAL")),
    
    selected = "AVALC",
    
    multiple = FALSE,
    
    fixed = FALSE
    
  )
  
)



fact_vars_adrs <- names(Filter(isTRUE, sapply(ADRS, is.factor)))



adrs_extracted_response_fct <- data_extract_spec(
  
  dataname = "ADRS",
  
  filter = adrs_filters,
  
  select = select_spec(
    
    choices = variable_choices(ADRS, subset = fact_vars_adrs),
    
    selected = "AVALC",
    
    multiple = FALSE,
    
    fixed = FALSE
    
  )
  
)



adlb_filter_paramcd <- filter_spec(
  
  vars = "PARAMCD",
  
  choices = value_choices(ADLB, "PARAMCD", "PARAM"),
  
  selected = levels(ADLB$PARAMCD)[1],
  
  multiple = FALSE,
  
  label = "Select lab:"
  
)

adlb_filter_paramcd2 <- filter_spec(
  
  vars = "PARAMCD",
  
  choices = value_choices(ADLB, "PARAMCD", "PARAM"),
  
  selected = levels(ADLB$PARAMCD)[2],
  
  multiple = FALSE,
  
  label = "Select lab:"
  
)

adlb_filter_visit <- filter_spec(
  
  vars = "AVISIT",
  
  choices = levels(ADLB$AVISIT),
  
  selected = levels(ADLB$AVISIT)[1],
  
  multiple = FALSE,
  
  label = "Select visit:"
  
)

adlb_extracted_aval <- data_extract_spec(
  
  dataname = "ADLB",
  
  select = select_spec(
    
    choices = variable_choices(ADLB, c("AVAL", "CHG", "PCHG", "ANRIND",
                                       "BASE")),
    
    selected = "AVAL",
    
    multiple = FALSE,
    
    fixed = FALSE
    
  ),
  
  filter = list(
    
    adlb_filter_paramcd,
    
    adlb_filter_visit
    
  )
  
)



numeric_vars_adlbpca <- names(Filter(isTRUE, sapply(ADLBPCA, is.numeric)))



distr_filter_spec <- filter_spec(
  
  vars = choices_selected(
    
    variable_choices(ADSL, fact_vars_adsl),
    
    selected = NULL
    
  ),
  
  multiple = TRUE
  
)



## App header and footer ----

nest_logo <- "
https://raw.githubusercontent.com/insightsengineering/hex-stickers/main/PNG/nest.png
"

app_source <- "
https://github.com/insightsengineering/teal.gallery/tree/main/exploratory"

gh_issues_page <- "
https://github.com/insightsengineering/teal.gallery/issues"



header <- tags$span(
  
  style = "display: flex; align-items: center; justify-content:
space-between; margin: 10px 0 10px 0;",
  
  tags$span("My first teal app", style = "font-size: 30px;"),
  
  tags$span(
    
    style = "display: flex; align-items: center;",
    
    tags$img(src = nest_logo, alt = "NEST logo", height = "45px", style =
               "margin-right:10px;"),
    
    tags$span(style = "font-size: 24px;", "NEST @ Roche")
    
  )
  
)



footer <- tags$p(
  
  "This teal app is brought to you by the NEST Team at Roche/Genentech.

        For more information, please visit:",
  
  tags$a(href = app_source, target = "_blank", "Source Code"), ", ",
  
  tags$a(href = gh_issues_page, target = "_blank", "Report Issues")
  
)



# Add before module definitions

fact_vars_adsl <- names(Filter(is.factor, ADSL))

numeric_vars_adsl <- names(Filter(is.numeric, ADSL))



adsl_extracted_fct2 <- data_extract_spec(
  
  dataname = "ADSL",
  
  select = select_spec(
    
    choices = variable_choices(ADSL, subset = fact_vars_adsl),
    
    selected = fact_vars_adsl[1],
    
    multiple = FALSE,
    
    fixed = FALSE
    
  )
  
)



adsl_extracted_fct3 <- adsl_extracted_fct2  # Replace with proper
# definition if needed

app <- init(
  
  data = data,
  
  filter = teal_slices(
    
    count_type = "all",
    
    teal_slice(dataname = "ADSL", varname = "SEX"),
    
    teal_slice(dataname = "ADSL", varname = "AGE")
    
  ),
  
  modules = modules(
    
    teal.modules.general::tm_front_page(
      
      label = "App Info",
      
      header_text = c(
        
        "Info about input data source" =
          
          "This app uses CDISC ADaM datasets randomly generated by
`random.cdisc.data` R packages"
        
      ),
      
      tables = list(
        
        `NEST packages used in this demo app` = data.frame(Packages =
                                                             c("teal.modules.general", "random.cdisc.data"))
        
      )
      
    ),
    
    teal.modules.general::tm_file_viewer(
      
      label = "File viewer",
      
      input_path = list(
        
        png = "https://www.r-project.org/logo/Rlogo.png",
        
        Rmd = "
https://raw.githubusercontent.com/tidyverse/dplyr/master/README.Rmd",
        
        pdf = "
https://cran.r-project.org/web/packages/shinyTree/shinyTree.pdf"
        
      )
      
    ),
    
    teal.modules.general::tm_data_table("Data Table"),
    
    teal.modules.general::tm_variable_browser("Variable Browser"),
    
    teal.modules.general::tm_missing_data("Missing Data"),
    
    teal.modules.general::tm_g_distribution(
      
      "Distribution",
      
      dist_var = adsl_extracted_numeric,
      
      strata_var = data_extract_spec(
        
        dataname = "ADSL",
        
        filter = distr_filter_spec
        
      ),
      
      group_var = data_extract_spec(
        
        dataname = "ADSL",
        
        filter = distr_filter_spec
        
      )
      
    ),
    
    teal.modules.general::tm_outliers(
      
      "Outliers",
      
      outlier_var = data_extract_spec(
        
        dataname = "ADLB",
        
        select = select_spec(
          
          choices = variable_choices(ADLB, c("AVAL", "CHG", "PCHG",
                                             "BASE")),
          
          selected = "AVAL",
          
          multiple = FALSE,
          
          fixed = FALSE
          
        )
        
      ),
      
      categorical_var = data_extract_spec(
        
        dataname = "ADLB",
        
        select = select_spec(
          
          choices = variable_choices(ADLB, c("PARAM", "PARAMCD")),
          
          selected = NULL,
          
          multiple = FALSE,
          
          fixed = FALSE
          
        )
        
      )
      
    ),
    
    teal.modules.general::tm_g_association(
      
      ref = adsl_extracted_num,
      
      vars = adsl_extracted_fct3
      
    ),
    
    teal.modules.general::tm_g_bivariate(
      
      x = adsl_extracted_num,
      
      y = adlb_extracted_aval,
      
      row_facet = adsl_extracted_factors,
      
      col_facet = adsl_extracted_factors,
      
      use_density = FALSE,
      
      plot_height = c(600L, 200L, 2000L),
      
      ggtheme = "gray"
      
    ),
    
    teal.modules.general::tm_a_regression(
      
      label = "Regression",
      
      response = adsl_extracted_numeric,
      
      regressor = adrs_extracted_response
      
    ),
    
    teal.modules.general::tm_g_response(
      
      response = adrs_extracted_response_fct,
      
      x = adsl_extracted_fct2,
      
      row_facet = adsl_extracted_factors,
      
      col_facet = adsl_extracted_factors,
      
      coord_flip = FALSE
      
    ),
    
    teal.modules.general::tm_g_scatterplotmatrix(
      
      label = "Scatterplot matrix",
      
      variables = adsl_extracted_multi
      
    ),
    
    teal.modules.general::tm_g_scatterplot(
      
      "Scatterplot",
      
      x = adsl_extracted_num,
      
      y = adsl_extracted_num2,
      
      row_facet = adsl_extracted_factors,
      
      col_facet = adsl_extracted_factors,
      
      color_by = adsl_extracted_factors,
      
      size = 3, alpha = 1,
      
      plot_height = c(600L, 200L, 2000L)
      
    ),
    
    teal.modules.general::tm_t_crosstable(
      
      "Table Choices",
      
      x = adsl_extracted_fct2,
      
      y = adsl_extracted_fct
      
    ),
#     
    teal.modules.general::tm_a_pca(

      "Principal Component Analysis",

      dat = data_extract_spec(

        dataname = "ADLBPCA",

        select = select_spec(

          choices = variable_choices(ADLBPCA, numeric_vars_adlbpca),

          selected = c("ALT - WEEK 5 DAY 36", "CRP - WEEK 5 DAY 36", "IGA - WEEK 5 DAY 36"),

          multiple = TRUE,

          fixed = FALSE,

          label = "Variable"

        ),

      ),

      plot_height = c(600L, 200L, 2000L),

      plot_width = c(600L, 200L, 2000L)

    )
    
  )
  
) |>
  
  modify_title(
    
    title = "Exploratory Analysis Teal Demo App",
    
    favicon = nest_logo
    
  ) |>
  
  modify_header(header) |>
  
  modify_footer(footer)



shinyApp(app$ui, app$server)

Closing

donyunardi avatar May 14 '25 21:05 donyunardi

I ran this code and the same issue occurs. The display object appears with all the analysis type options but when I click on any of them there is no data that are displayed. I would have tried to debug with a browse() function in the server function but the TEAL modules shelter the user from the server function. So, I can't look inside the module to see what data were selected.

probert7-git2 avatar May 26 '25 23:05 probert7-git2

@probert7-git2 Could you share your sessionInfo()?

vedhav avatar May 26 '25 23:05 vedhav

R version 4.4.1 (2024-06-14 ucrt) Platform: x86_64-w64-mingw32/x64 Running under: Windows 11 x64 (build 22631)

Matrix products: default

locale: [1] LC_COLLATE=English_United States.utf8 LC_CTYPE=English_United States.utf8 LC_MONETARY=English_United States.utf8 [4] LC_NUMERIC=C LC_TIME=English_United States.utf8

time zone: America/Los_Angeles tzcode source: internal

attached base packages: [1] stats graphics grDevices utils datasets methods base

other attached packages: [1] colourpicker_1.3.0 broom_1.0.6 rlang_1.1.4 MASS_7.3-60.2 [5] lattice_0.22-6 jsonlite_1.8.9 htmlwidgets_1.6.4 gridExtra_2.3 [9] goftest_1.2-3 ggpmisc_0.6.1 ggpp_0.5.8-1 ggExtra_0.10.1 [13] sparkline_2.0 nestcolor_0.1.3 teal.modules.clinical_0.10.0 tern_0.9.8 [17] rtables_0.6.12 magrittr_2.0.3 formatters_0.5.11 logger_0.4.0 [21] teal.logger_0.3.2 tidyr_1.3.1 dplyr_1.1.4 random.cdisc.data_0.3.16 [25] teal.modules.general_0.4.1 teal.transform_0.6.0 ggmosaic_0.3.3 ggplot2_3.5.2 [29] teal_0.16.0 teal.slice_0.6.0 teal.data_0.7.0 teal.code_0.6.1 [33] shiny_1.9.1

loaded via a namespace (and not attached): [1] Rdpack_2.6.4 polynom_1.4-1 bsicons_0.1.2 tern.gee_0.1.5 sandwich_3.1-1 [6] multcomp_1.4-28 compiler_4.4.1 vctrs_0.6.5 quantreg_6.1 stringr_1.5.1 [11] pkgconfig_2.0.3 fastmap_1.2.0 backports_1.5.0 fontawesome_0.5.3 utf8_1.2.4 [16] promises_1.3.2 rmarkdown_2.29 MatrixModels_0.5-4 purrr_1.0.2 xfun_0.52 [21] cachem_1.1.0 teal.reporter_0.4.0 later_1.4.1 R6_2.6.1 bslib_0.9.0 [26] stringi_1.8.4 lubridate_1.9.3 jquerylib_0.1.4 estimability_1.5.1 Rcpp_1.0.13-1 [31] knitr_1.50 zoo_1.8-14 httpuv_1.6.15 Matrix_1.7-0 splines_4.4.1 [36] timechange_0.3.0 tidyselect_1.2.1 rstudioapi_0.16.0 yaml_2.3.10 codetools_0.2-20 [41] miniUI_0.1.1.1 teal.widgets_0.4.3.9002 tibble_3.2.1 withr_3.0.2 evaluate_1.0.3 [46] survival_3.8-3 pillar_1.10.2 checkmate_2.3.2 renv_1.1.4 DT_0.33 [51] shinyjs_2.1.0 plotly_4.10.4 generics_0.1.3 mirai_2.2.0 munsell_0.5.1 [56] scales_1.3.0 xtable_1.8-4 glue_1.7.0 emmeans_1.11.0 lazyeval_0.2.2 [61] tools_4.4.1 shinyTree_0.3.1 data.table_1.16.0 SparseM_1.84-2 fs_1.6.4 [66] mvtnorm_1.3-3 grid_4.4.1 rbibutils_2.3 crosstalk_1.2.1 colorspace_2.1-1 [71] nlme_3.1-164 cli_3.6.3 viridisLite_0.4.2 geepack_1.3.12 gtable_0.3.6 [76] sass_0.4.10 digest_0.6.37 ggrepel_0.9.6 TH.data_1.1-3 nanonext_1.5.2 [81] memoise_2.0.1 htmltools_0.5.8.1 lifecycle_1.0.4 httr_1.4.7 shinyWidgets_0.9.0 [86] mime_0.12

On Mon, May 26, 2025 at 4:13 PM Vedha Viyash @.***> wrote:

vedhav left a comment (insightsengineering/teal.gallery#202) https://github.com/insightsengineering/teal.gallery/issues/202#issuecomment-2910747587

@probert7-git2 https://github.com/probert7-git2 Could you share your sessionInfo()?

— Reply to this email directly, view it on GitHub https://github.com/insightsengineering/teal.gallery/issues/202#issuecomment-2910747587, or unsubscribe https://github.com/notifications/unsubscribe-auth/BQH2MY22QSKXJND2U3ICEE33AON2RAVCNFSM6AAAAAB37HFFAGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDSMJQG42DONJYG4 . You are receiving this because you were mentioned.Message ID: @.***>

probert7-git2 avatar May 29 '25 19:05 probert7-git2