Closed vedhav closed 6 months ago
Observed in the "Line Plot" module of the longitudinal app in teal.gallery. It produces this error caused by this line in the srv_lineplot():
teal.gallery
Warning: Error in [[: subscript out of bounds 168: <Anonymous> 167: FUN [/Users/vedha/insightsengineering/teal.goshawk/R/tm_g_gh_lineplot.R#529] 166: vapply 164: <reactive:line_type_selected> [/Users/vedha/insightsengineering/teal.goshawk/R/tm_g_gh_lineplot.R#524] 148: line_type_selected 141: <reactive:plot_q> [/Users/vedha/insightsengineering/teal.goshawk/R/tm_g_gh_lineplot.R#685] 125: plot_q 124: <reactive> 108: plot_r 99: renderUI 98: func 85: renderFunc 84: output$teal-main_ui-root-line_plot-module-plot-plot_out_main 3: runApp 2: print.shiny.appobj 1: <Anonymous> Warning: Error in [[: subscript out of bounds 3: runApp 2: print.shiny.appobj 1: <Anonymous>
library(teal.goshawk) data <- teal_data() data <- within(data, { library(dplyr) library(stringr) library(nestcolor) # original ARM value = dose value arm_mapping <- list( "A: Drug X" = "150mg QD", "B: Placebo" = "Placebo", "C: Combination" = "Combination" ) ADSL <- goshawk::rADSL ADLB <- goshawk::rADLB var_labels <- lapply(ADLB, function(x) attributes(x)$label) ADLB <- ADLB %>% dplyr::mutate( AVISITCD = dplyr::case_when( AVISIT == "SCREENING" ~ "SCR", AVISIT == "BASELINE" ~ "BL", grepl("WEEK", AVISIT) ~ paste("W", stringr::str_extract(AVISIT, "(?<=(WEEK ))[0-9]+")), TRUE ~ as.character(NA) ), AVISITCDN = dplyr::case_when( AVISITCD == "SCR" ~ -2, AVISITCD == "BL" ~ 0, grepl("W", AVISITCD) ~ as.numeric(gsub("[^0-9]*", "", AVISITCD)), TRUE ~ as.numeric(NA) ), AVISITCD = factor(AVISITCD) %>% reorder(AVISITCDN), TRTORD = dplyr::case_when( ARMCD == "ARM C" ~ 1, ARMCD == "ARM B" ~ 2, ARMCD == "ARM A" ~ 3 ), ARM = as.character(arm_mapping[match(ARM, names(arm_mapping))]), ARM = factor(ARM) %>% reorder(TRTORD), ACTARM = as.character(arm_mapping[match(ACTARM, names(arm_mapping))]), ACTARM = factor(ACTARM) %>% reorder(TRTORD) ) attr(ADLB[["ARM"]], "label") <- var_labels[["ARM"]] attr(ADLB[["ACTARM"]], "label") <- var_labels[["ACTARM"]] }) datanames <- c("ADSL", "ADLB") datanames(data) <- datanames join_keys(data) <- default_cdisc_join_keys[datanames] app <- teal::init( data = data, modules = teal::modules( teal.goshawk::tm_g_gh_lineplot( label = "Line Plot", dataname = "ADLB", param_var = "PARAMCD", param = choices_selected(c("ALT", "CRP", "IGA"), "ALT"), shape_choices = c("SEX", "RACE"), xaxis_var = choices_selected("AVISITCD", "AVISITCD"), yaxis_var = choices_selected(c("AVAL", "BASE", "CHG", "PCHG"), "AVAL"), trt_group = choices_selected(c("ARM", "ACTARM"), "ARM"), hline_arb = c(20.5, 19.5), hline_arb_color = c("red", "green"), hline_arb_label = c("A", "B") ) ) ) if (interactive()) { shinyApp(app$ui, app$server) }
I'm using the `main` branch version of all the packages.
No response
Also, when trying to fix this direct bug the table output seems to be wrong.
What happened?
Observed in the "Line Plot" module of the longitudinal app in
teal.gallery
. It produces this error caused by this line in the srv_lineplot():Example app code to reproduce this error
sessionInfo()
Relevant log output
No response
Code of Conduct
Contribution Guidelines
Security Policy