Repository navigation
Closed
Labels
TrackB_RMedicine_Hackathon_Apr2026bugSomething isn't workingSomething isn't workingcoregood first issueGood for newcomersGood for newcomers
Description
What happened?
A bug happened!
ggplot2_args throws an error when teal app using using teal_data_module().
Code
library(teal)
tdm <- teal_data_module(
ui = function(id) {
ns <- NS(id)
actionButton(ns("submit"), label = "Load data")
},
server = function(id) {
moduleServer(id, function(input, output, session) {
eventReactive(input$submit, {
data <- within(
teal_data(),
{
iris <- iris
mtcars <- mtcars
}
)
data
})
})
}
)
app <- init(
data = tdm,
modules = modules(
tm_g_distribution(
dist_var = data_extract_spec(
dataname = "iris",
select = select_spec(variable_choices("iris"), "Petal.Length")
),
ggplot2_args = teal.widgets::ggplot2_args(
theme = list(text = element_text(size = 20))
)
)
),
title = "my teal app"
)
shinyApp(app$ui, app$server)
This is because R immediately runs element_text(size = 20).
One way to fix it from user's perspective is to quote() it.
ggplot2_args = teal.widgets::ggplot2_args(
theme = list(text = quote(element_text(size = 20)))
)Is this the only way to do this or is there a better way?
sessionInfo()
r$> sessionInfo()
R version 4.5.2 (2025-10-31)
Platform: aarch64-apple-darwin20
Running under: macOS Sequoia 15.7.3
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.12.1
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
time zone: America/Los_Angeles
tzcode source: internal
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] ggpp_0.5.8-1 magrittr_2.0.4 tibble_3.3.0 tidyr_1.3.1 dplyr_1.1.4
[6] teal.modules.general_0.6.0 teal.transform_0.7.1.9001 ggplot2_4.0.0 teal_1.1.0.9017 teal.slice_0.7.1.9004
[11] teal.data_0.8.0.9002 teal.code_0.7.1.9000 shiny_1.12.1
loaded via a namespace (and not attached):
[1] shinyvalidate_0.1.3 gtable_0.3.6 xfun_0.52 bslib_0.9.0 shinyjs_2.1.0 htmlwidgets_1.6.4
[7] teal.widgets_0.5.1.9005 formatters_0.5.12 vctrs_0.6.5 tools_4.5.2 crosstalk_1.2.1 generics_0.1.4
[13] pkgconfig_2.0.3 mirai_2.5.0 checkmate_2.3.2 RColorBrewer_1.1-3 S7_0.2.1 lifecycle_1.0.4
[19] compiler_4.5.2 farver_2.1.2 textshaping_1.0.1 fontawesome_0.5.3 httpuv_1.6.16 shinyWidgets_0.9.0
[25] htmltools_0.5.9 sass_0.4.10 yaml_2.3.10 later_1.4.4 pillar_1.11.1 crayon_1.5.3
[31] jquerylib_0.1.4 MASS_7.3-65 DT_0.33 cachem_1.1.0 rtables_0.6.15 mime_0.13
[37] tidyselect_1.2.1 digest_0.6.39 stringi_1.8.7 purrr_1.0.4 labeling_0.4.3 fastmap_1.2.0
[43] grid_4.5.2 cli_3.6.5 logger_0.4.1 bsicons_0.1.2 withr_3.0.2 teal.reporter_0.6.0.9002
[49] scales_1.4.0 promises_1.5.0 backports_1.5.0 otel_0.2.0 gridExtra_2.3 ragg_1.4.0
[55] memoise_2.0.1 evaluate_1.0.5 knitr_1.50 shinycssloaders_1.1.0 rlang_1.1.6 nanonext_1.7.0
[61] Rcpp_1.1.0 polynom_1.4-1 xtable_1.8-4 glue_1.8.0 renv_1.1.4 formatR_1.14
[67] jsonlite_2.0.0 teal.logger_0.4.1.9002 R6_2.6.1 systemfonts_1.2.3 fs_1.6.6Code 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.
Reacted by Lluís Revilla
Metadata
Metadata
Assignees
Labels
TrackB_RMedicine_Hackathon_Apr2026bugSomething isn't workingSomething isn't workingcoregood first issueGood for newcomersGood for newcomers
Activity
stefanlinner commentedon Apr 23, 2026
I'll work on that
llrs-roche commentedon Sep 21, 2026
On ggplot2 there is this
merge_element()and an (currently) internalcombine_element()that allow to combine them with less problems. There is a plan to exportcombine_element()at tidyverse/ggplot2#6882 but we might want to start moving on teal.widget tomerge_element()if it makes sense. We would accessing internal ggplot2 list of accepted aesthetics.all_aestheticsand we would delegate managing this to ggplot2.After writing the paragraph above I realized it doesn't solve the problem of going of preserving the text used to generate the code. However, there are other ways to solve this. Currently we have an element we parse what is modified and we modify the element to pass it to the module on teal.widgets. We could preserve the call/quote by
ggplot2_args()so that the user does not need to think about doing it or for "special cases".llrs-roche commentedon Nov 4, 2026
Fixed with pharmaverse/teal.widgets#369: