@@ -39,7 +39,7 @@ See [package functions / modules](https://insightsengineering.github.io/teal.mod
3939### Example application
4040
4141A simple application featuring the ` tm_variable_browser() ` module:
42- ``` {r app, message = FALSE, results = "hide", eval = requireNamespace("sparkline", quietly = TRUE) }
42+ ``` {r app, eval=FALSE }
4343# load libraries
4444library(teal.modules.general)
4545library(teal.widgets)
@@ -66,20 +66,15 @@ app <- init(
6666 data = data,
6767 modules = modules(tm_variable_browser_module)
6868)
69- ```
7069
71- ``` {r shinyapp, eval = FALSE}
7270shinyApp(app$ui, app$server)
7371```
7472
75- <img src =" images/app-teal-modules-general.png " style = " display : block ; margin : 0px ; width : 100% " />
76-
7773### Try it out in Shinylive
7874
79- ``` {r shinylive_url, echo = FALSE, results = 'asis', eval = requireNamespace("roxy.shinylive", quietly = TRUE) }
75+ ``` {r shinylive_url, echo = FALSE, results = 'asis'}
8076code <- paste0(c(
81- knitr::knit_code$get("app"),
82- knitr::knit_code$get("shinyapp")
77+ knitr::knit_code$get("app")
8378), collapse = "\n")
8479
8580url <- roxy.shinylive::create_shinylive_url(code)
@@ -93,7 +88,7 @@ knitr::include_url(url, height = "800px")
9388Let's break the above app into pieces:
9489
95901: Load the necessary libraries and data.
96- ``` r
91+ ``` {r warning=FALSE, message=FALSE}
9792library(teal.modules.general)
9893library(teal.widgets)
9994```
@@ -103,7 +98,7 @@ To do this, we create an empty `teal_data` object and evaluate code to produce t
10398
10499Following this, we set the ` datanames ` and ` join_keys ` .
105100
106- ``` r
101+ ``` {r warning=FALSE, message=FALSE}
107102data <- teal_data()
108103data <- within(data, {
109104 ADSL <- teal.data::rADSL
@@ -117,7 +112,7 @@ join_keys(data) <- default_cdisc_join_keys[names(data)]
117112` shiny::shinyApp() ` use the ` ui ` and ` server ` component to initialize the ` teal ` app.
118113
119114
120- ``` r
115+ ``` {r warning=FALSE, message=FALSE}
121116tm_variable_browser_module <- tm_variable_browser(
122117 # module name to display in the GUI
123118 label = "Variable browser",
@@ -133,7 +128,9 @@ app <- init(
133128 modules = modules(tm_variable_browser_module)
134129)
135130
136- shinyApp(app $ ui , app $ server )
131+ if (interactive()) {
132+ shinyApp(app$ui, app$server)
133+ }
137134```
138135
139136In a ` teal ` app, data and modules are decoupled. In the app above:
0 commit comments