Skip to content

Bug when adding a CARD when module contains a character needed for wrapping #1382

@jenko1979

Description

@jenko1979

What happened?

When any module contains text that has \n to aid with wrapping , it does not then allow it to be added to a card. This is seen in my example code below, where the label we have for variable that is being used in tm_t_summry contains \n to aid with wrapping. This you can see is perfect in the module, but when you add it as a card , it errors (see screenshot).

data <- teal_data()
data <- within(data, {
  ADSL <- tmc_ex_adsl %>% 
    mutate(LONGVARLABEL = as.factor("Y"))
  attr(ADSL$LONGVARLABEL, "label") <-"This has a long label which we want to wrap in\n the table by use of a special character"
  ADSL$EOSDY[1] <- NA_integer_
})
join_keys(data) <- default_cdisc_join_keys[names(data)]

ADSL <- data[["ADSL"]]

app <- init(
  data = data,
  modules = modules(
    tm_t_summary(
      label = "Demographic Table",
      dataname = "ADSL",
      arm_var = choices_selected(c("ARM", "ARMCD"), "ARM"),
      add_total = TRUE,
      summarize_vars = choices_selected(
        c("LONGVARLABEL"),
        c("LONGVARLABEL")
      ),
      useNA = "ifany"
    )
  )
)
if (interactive()) {
  shinyApp(app$ui, app$server)
}

I also tried this on tm_t_events module where i had AETERM that i needed to wrap by adding in \n to the text as well as the text here was very very long and

the same issue occurred when adding a card.

sessionInfo()

R version 4.4.1 (2024-06-14)
Platform: x86_64-pc-linux-gnu
Running under: Rocky Linux 8.10 (Green Obsidian)

Matrix products: default
BLAS/LAPACK: /usr/lib64/libopenblasp-r0.3.15.so;  LAPACK version 3.9.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8      
 [8] LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C             LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

time zone: Etc/UTC
tzcode source: system (glibc)

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

other attached packages:
 [1] forcats_1.0.0                       teal.widgets_0.4.3                  DT_0.33                             openxlsx_4.2.8                      fs_1.6.5                           
 [6] stringr_1.5.1                       tidyr_1.3.1                         haven_2.5.4                         dplyr_1.1.4                         tibble_3.2.1                       
[11] teal.reporter_0.4.0                 httr2_1.1.0                         junco_0.0.1                         tidytlg_0.1.5                       teal.modules.clinical.junco_0.1.4.1
[16] teal.modules.general_0.4.0          ggmosaic_0.3.3                      ggplot2_3.5.1                       teal.modules.clinical_0.10.0        tern_0.9.7                         
[21] rtables_0.6.11                      magrittr_2.0.3                      formatters_0.5.10                   teal.transform_0.6.0                teal_0.16.0                        
[26] teal.slice_0.6.0                    teal.data_0.7.0                     teal.code_0.6.1                     shiny_1.10.0                       

loaded via a namespace (and not attached):
  [1] rstudioapi_0.17.1       jsonlite_1.9.0          nestcolor_0.1.3         TH.data_1.1-3           estimability_1.5.1      farver_2.1.2            rmarkdown_2.29          ragg_1.3.3             
  [9] geepack_1.3.12          vctrs_0.6.5             memoise_2.0.1           askpass_1.2.1           htmltools_0.5.8.1       broom_1.0.7             cellranger_1.1.0        gridGraphics_0.5-1     
 [17] sass_0.4.9              huxtable_5.5.7          bslib_0.9.0             htmlwidgets_1.6.4       fontawesome_0.5.3       sandwich_3.1-1          emmeans_1.10.7          plotly_4.10.4          
 [25] zoo_1.8-13              cachem_1.1.0            uuid_1.2-1              mime_0.12               lifecycle_1.0.4         pkgconfig_2.0.3         Matrix_1.7-1            R6_2.6.1               
 [33] fastmap_1.2.0           rbibutils_2.3           digest_0.6.37           colorspace_2.1-1        shinycssloaders_1.1.0   patchwork_1.3.0         pkgload_1.4.0           textshaping_1.0.0      
 [41] crosstalk_1.2.1         httr_1.4.7              compiler_4.4.1          fontquiver_0.2.1        withr_3.0.2             backports_1.5.0         logger_0.4.0            MASS_7.3-61            
 [49] openssl_2.3.2           rappdirs_0.3.3          tools_4.4.1             zip_2.3.2               httpuv_1.6.15           shinyvalidate_0.1.3     glue_1.8.0              nlme_3.1-166           
 [57] promises_1.3.2          grid_4.4.1              rsconnect_1.3.4         checkmate_2.3.2         rtables.officer_0.0.2   generics_0.1.3          gtable_0.3.6            tzdb_0.4.0             
 [65] data.table_1.17.0       hms_1.1.3               xml2_1.3.7              ggrepel_0.9.6           pillar_1.10.1           yulab.utils_0.2.0       later_1.4.1             splines_4.4.1          
 [73] tern.gee_0.1.5          lattice_0.22-6          renv_1.0.7              survival_3.7-0          tidyselect_1.2.1        fontLiberation_0.1.0    knitr_1.49              fontBitstreamVera_0.1.1
 [81] teal.logger_0.3.2       xfun_0.51               stringi_1.8.4           lazyeval_0.2.2          yaml_2.3.10             shinyWidgets_0.9.0      evaluate_1.0.3          codetools_0.2-20       
 [89] officer_0.6.7           gdtools_0.4.1           ggplotify_0.1.2         cli_3.6.4               systemfonts_1.2.1       xtable_1.8-4            Rdpack_2.6.2            munsell_0.5.1          
 [97] jquerylib_0.1.4         Rcpp_1.0.14             readxl_1.4.3            png_0.1-8               readr_2.1.5             assertthat_0.2.1        viridisLite_0.4.2       mvtnorm_1.3-3          
[105] scales_1.3.0            purrr_1.0.4             crayon_1.5.3            flextable_0.9.7         rlang_1.1.5             cowplot_1.1.3           multcomp_1.4-28         shinyjs_2.1.0

Relevant log output

The card could not be added to the report. Have the outputs for the report been created yet? If not please try again when they are ready. Otherwise contact your application developer

Code of Conduct

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

Contribution Guidelines

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

Security Policy

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcore

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions