-
Notifications
You must be signed in to change notification settings - Fork 0
/
exercise_1.qmd
69 lines (54 loc) · 1.8 KB
/
exercise_1.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
---
title: "Exercise 1"
---
Create your first `teal` application!
- read [`teal::init()`](https://insightsengineering.github.io/teal/latest-tag/reference/init.html) documentation
- use [`random.cdisc.data::radsl(cached = TRUE)`](https://insightsengineering.github.io/random.cdisc.data/main/reference/radsl.html) to create a dummy ADSL dataset
- use [`teal::example_module()`](https://insightsengineering.github.io/teal/latest-tag/reference/example_module.html) to create a dummy module
### Code
```{r ex, message = FALSE}
library(random.cdisc.data)
library(teal)
data <- teal_data()
data <- within(data, {
ADSL <- radsl(cached = TRUE)
})
# set datanames
datanames <- c("ADSL")
datanames(data) <- datanames
## Reusable Configuration For Modules
ADSL <- data[["ADSL"]]
header <- tags$span(
style = "display: flex; align-items: center; justify-content: space-between; margin: 10px 0 10px 0;",
tags$span("Excercise 1", style = "font-size: 30px;"),
)
footer <- tags$p(
"This teal app is brought to you by PhUSE SDE Basel."
)
app <- init(
data = data,
modules = modules(
example_module()
),
title = build_app_title("Basic Teal Demo App"),
header = header,
footer = footer
)
if (Sys.getenv("QUARTO_ROOT") == "") {
shinyApp(app$ui, app$server)
}
```
```{r save_script, include = FALSE}
code <- paste0(knitr::knit_code$get("ex"), collapse = "\n")
writeLines(code, "scripts/exercise_1.R")
```
### URL
```{r shinylive_url, echo = FALSE, results = 'asis', purl = FALSE}
code <- paste0(knitr::knit_code$get("ex"), collapse = "\n")
url <- roxy.shinylive::create_shinylive_url(code)
cat(sprintf("[Open in Shinylive](%s)\n\n", url))
```
### App
```{r shinylive_iframe, echo = FALSE, out.width = '150%', out.extra = 'style = "position: relative; z-index:1"', purl = FALSE}
knitr::include_url(url, height = "800px")
```