Skip to content

Commit 9f0f7c2

Browse files
committed
docs: have consistant code chunk format
1 parent ee725dd commit 9f0f7c2

10 files changed

+18
-39
lines changed

vignettes/teal-modules-general.Rmd

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ See [package functions / modules](https://insightsengineering.github.io/teal.mod
3939
### Example application
4040

4141
A 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
4444
library(teal.modules.general)
4545
library(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}
7270
shinyApp(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'}
8076
code <- paste0(c(
81-
knitr::knit_code$get("app"),
82-
knitr::knit_code$get("shinyapp")
77+
knitr::knit_code$get("app")
8378
), collapse = "\n")
8479
8580
url <- roxy.shinylive::create_shinylive_url(code)
@@ -93,7 +88,7 @@ knitr::include_url(url, height = "800px")
9388
Let's break the above app into pieces:
9489

9590
1: Load the necessary libraries and data.
96-
```r
91+
```{r warning=FALSE, message=FALSE}
9792
library(teal.modules.general)
9893
library(teal.widgets)
9994
```
@@ -103,7 +98,7 @@ To do this, we create an empty `teal_data` object and evaluate code to produce t
10398

10499
Following this, we set the `datanames` and `join_keys`.
105100

106-
```r
101+
```{r warning=FALSE, message=FALSE}
107102
data <- teal_data()
108103
data <- 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}
121116
tm_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

139136
In a `teal` app, data and modules are decoupled. In the app above:

vignettes/using-association-plot.Rmd

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,12 +294,10 @@ app <- init(
294294

295295
A simple `shiny::shinyApp()` call will let you run the app. Note that app is only displayed when running this code inside an `R` session.
296296

297-
```{r shinyapp, echo=TRUE, results="hide", eval=base::interactive()}
297+
```{r shinyapp, eval=FALSE}
298298
shinyApp(app$ui, app$server, options = list(height = 1024, width = 1024))
299299
```
300300

301-
<img src="images/app-using-association-plot.png" style="display: block; margin: 0px; width: 100%"/>
302-
303301
## 5 - Try it out in Shinylive
304302

305303
```{r shinylive_url, echo = FALSE, results = 'asis', eval = requireNamespace("roxy.shinylive", quietly = TRUE)}

vignettes/using-bivariate-plot.Rmd

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -620,12 +620,10 @@ app <- init(
620620
A simple `shiny::shinyApp()` call will let you run the app.
621621
Note that app is only displayed when running this code inside an `R` session.
622622

623-
```{r shinyapp, echo=TRUE, results="hide", eval=base::interactive()}
623+
```{r shinyapp, eval=FALSE}
624624
shinyApp(app$ui, app$server, options = list(height = 1024, width = 1024))
625625
```
626626

627-
<img src="images/app-using-bivariate-plot.png" style = "display: block; margin: 0px; width: 100%"/>
628-
629627
## 5 - Try it out in Shinylive
630628

631629
```{r shinylive_url, echo = FALSE, results = 'asis', eval = requireNamespace("roxy.shinylive", quietly = TRUE)}

vignettes/using-cross-table.Rmd

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,10 @@ app <- init(
137137
A simple `shiny::shinyApp()` call will let you run the app.
138138
Note that app is only displayed when running this code inside an `R` session.
139139

140-
```{r shinyapp, echo=TRUE, results="hide", eval=base::interactive()}
140+
```{r shinyapp, eval=FALSE}
141141
shinyApp(app$ui, app$server, options = list(height = 1024, width = 1024))
142142
```
143143

144-
<img src="images/app-using-cross-table.png" style = "display: block; margin: 0px; width: 100%"/>
145-
146144
## 5 - Try it out in Shinylive
147145

148146
```{r shinylive_url, echo = FALSE, results = 'asis', eval = requireNamespace("roxy.shinylive", quietly = TRUE)}

vignettes/using-data-table.Rmd

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,10 @@ app <- init(
107107
A simple `shiny::shinyApp()` call will let you run the app.
108108
Note that app is only displayed when running this code inside an `R` session.
109109

110-
```{r shinyapp, echo=TRUE, results="hide", eval=base::interactive()}
110+
```{r shinyapp, eval=FALSE}
111111
shinyApp(app$ui, app$server, options = list(height = 1024, width = 1024))
112112
```
113113

114-
<img src="images/app-using-data-table.png" style = "display: block; margin: 0px; width: 100%"/>
115-
116114
## 5 - Try it out in Shinylive
117115

118116
```{r shinylive_url, echo = FALSE, results = 'asis', eval = requireNamespace("roxy.shinylive", quietly = TRUE)}

vignettes/using-outliers-module.Rmd

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -188,12 +188,10 @@ app <- init(
188188
A simple `shiny::shinyApp()` call will let you run the app.
189189
Note that app is only displayed when running this code inside an `R` session.
190190

191-
```{r shinyapp, echo=TRUE, results="hide", eval=base::interactive()}
191+
```{r shinyapp, eval=FALSE}
192192
shinyApp(app$ui, app$server, options = list(height = 1024, width = 1024))
193193
```
194194

195-
<img src="images/app-using-outliers-module.png" style = "display: block; margin: 0px; width: 100%"/>
196-
197195
## 5 - Try it out in Shinylive
198196

199197
```{r shinylive_url, echo = FALSE, results = 'asis', eval = requireNamespace("roxy.shinylive", quietly = TRUE)}

vignettes/using-regression-plots.Rmd

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,12 +267,10 @@ app <- init(
267267
A simple `shiny::shinyApp()` call will let you run the app.
268268
Note that app is only displayed when running this code inside an `R` session.
269269

270-
```{r shinyapp, echo=TRUE, results="hide", eval=base::interactive()}
270+
```{r shinyapp, eval=FALSE}
271271
shinyApp(app$ui, app$server, options = list(height = 1024, width = 1024))
272272
```
273273

274-
<img src="images/app-using-regression-plots.png" style = "display: block; margin: 0px; width: 100%"/>
275-
276274
## 5 - Try it out in Shinylive
277275

278276
```{r shinylive_url, echo = FALSE, results = 'asis', eval = requireNamespace("roxy.shinylive", quietly = TRUE)}

vignettes/using-response-plot.Rmd

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -376,12 +376,10 @@ app <- init(
376376
A simple `shiny::shinyApp()` call will let you run the app.
377377
Note that app is only displayed when running this code inside an `R` session.
378378

379-
```{r shinyapp, echo=TRUE, results="hide", eval=base::interactive()}
379+
```{r shinyapp, eval=FALSE}
380380
shinyApp(app$ui, app$server, options = list(height = 1024, width = 1024))
381381
```
382382

383-
<img src="images/app-using-response-plot.png" style = "display: block; margin: 0px; width: 100%"/>
384-
385383
## 5 - Try it out in Shinylive
386384

387385
```{r shinylive_url, echo = FALSE, results = 'asis', eval = requireNamespace("roxy.shinylive", quietly = TRUE)}

vignettes/using-scatterplot-matrix.Rmd

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,10 @@ app <- init(
155155
A simple `shiny::shinyApp()` call will let you run the app.
156156
Note that app is only displayed when running this code inside an `R` session.
157157

158-
```{r shinyapp, echo=TRUE, results="hide", eval=base::interactive()}
158+
```{r shinyapp, eval=FALSE}
159159
shinyApp(app$ui, app$server, options = list(height = 1024, width = 1024))
160160
```
161161

162-
<img src="images/app-using-scatterplot-matrix.png" style = "display: block; margin: 0px; width: 100%"/>
163-
164162
## 5 - Try it out in Shinylive
165163

166164
```{r shinylive_url, echo = FALSE, results = 'asis', eval = requireNamespace("roxy.shinylive", quietly = TRUE)}

vignettes/using-scatterplot.Rmd

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -371,12 +371,10 @@ app <- init(
371371
A simple `shiny::shinyApp()` call will let you run the app.
372372
Note that app is only displayed when running this code inside an `R` session.
373373

374-
```{r shinyapp, echo=TRUE, results="hide", eval=base::interactive()}
374+
```{r shinyapp, eval=FALSE}
375375
shinyApp(app$ui, app$server, options = list(height = 1024, width = 1024))
376376
```
377377

378-
<img src="images/app-using-scatterplot.png" style = "display: block; margin: 0px; width: 100%"/>
379-
380378
## 5 - Try it out in Shinylive
381379

382380
```{r shinylive_url, echo = FALSE, results = 'asis', eval = requireNamespace("roxy.shinylive", quietly = TRUE)}

0 commit comments

Comments
 (0)