-
Notifications
You must be signed in to change notification settings - Fork 5
/
recap_lab10.qmd
227 lines (166 loc) · 7.68 KB
/
recap_lab10.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
---
title: "Recap of Lab 9"
author: "Søren Helweg Dam"
format:
revealjs:
embed-resources: true
theme: moon
slide-number: c/t
width: 1600
height: 900
mainfont: avenir
logo: images/r4bds_logo_small.png
footer: "R for Bio Data Science"
---
```{r setup}
#| include: false
knitr::opts_chunk$set(echo = FALSE)
```
# Exercises recap
<!--# ---------------------------------------------------------------------- -->
<!--# SLIDE ---------------------------------------------------------------- -->
<!--# ---------------------------------------------------------------------- -->
## Lab 9 Learning Objectives
_A student who has met the objectives of the session will be able to:_
- Prepare a simple shiny application
- Using relevant online resources to autonomously identify and obtain new and expand on existing knowledge of R
<!--# ---------------------------------------------------------------------- -->
<!--# SLIDE ---------------------------------------------------------------- -->
<!--# ---------------------------------------------------------------------- -->
## How to build an R shiny app
- Use `golem` from the get-go
- Start with layout (UI/UX)
- Use online resources for inspiration
- Bear in mind how `declarative` programming works
- Use the reactivity slide for inspiration
- Break your app into modules
<!--# ---------------------------------------------------------------------- -->
<!--# SLIDE ---------------------------------------------------------------- -->
<!--# ---------------------------------------------------------------------- -->
## Exercises
- A lot of new stuff (functions, terms, ways of programming)
- GitHub does not allow multiple people to push the same changes
<!--# ---------------------------------------------------------------------- -->
<!--# SLIDE ---------------------------------------------------------------- -->
<!--# ---------------------------------------------------------------------- -->
## Developing apps on the Shiny server
Shiny servers are not built for development.
</br>
- Remember if you get a "Not Found" error, the "/shiny/" might be missing from the url.
- Your app must be in `~/ShinyApps/` to be found.
- If the app inexplicably don't work, check the log in `ShinyApps/log/` for error messages.
- If no changes appear, close the tab for a minute and try again.
- _Close your app before continuing so future changes take effect._
- Going forward, develop locally and deploy later.
<!--# ---------------------------------------------------------------------- -->
<!--# SLIDE ---------------------------------------------------------------- -->
<!--# ---------------------------------------------------------------------- -->
# Assignment recap
<!--# ---------------------------------------------------------------------- -->
<!--# SLIDE ---------------------------------------------------------------- -->
<!--# ---------------------------------------------------------------------- -->
## Challenges with shiny
- New challenging topic
- More how-to examples would be great
- Requires more than fours hours to learn
- Complex structure and logic
- Does it matter where to put code? [Yes, but no](https://services.healthtech.dtu.dk/shiny/sohdam/ShinyDogma/)
<!--# ---------------------------------------------------------------------- -->
<!--# SLIDE ---------------------------------------------------------------- -->
<!--# ---------------------------------------------------------------------- -->
## Challenges with shiny
- New challenging topic
- More how-to examples would be great
- Requires more than fours hours to learn
- Complex structure and logic
- Does it matter where to put code? [Yes, but no](https://services.healthtech.dtu.dk/shiny/sohdam/ShinyDogma/)
- Hard to collaborate
- Git-conflict galore
<!--# ---------------------------------------------------------------------- -->
<!--# SLIDE ---------------------------------------------------------------- -->
<!--# ---------------------------------------------------------------------- -->
## Challenges with shiny
- New challenging topic
- More how-to examples would be great
- Requires more than fours hours to learn
- Complex structure and logic
- Does it matter where to put code? [Yes, but no](https://services.healthtech.dtu.dk/shiny/sohdam/ShinyDogma/)
- Hard to collaborate
- Git-conflict galore
- Debugging is challenging, especially on a Shiny server
- No error messages
- Unclear when changes took effect
<!--# ---------------------------------------------------------------------- -->
<!--# SLIDE ---------------------------------------------------------------- -->
<!--# ---------------------------------------------------------------------- -->
## Pros and cons with `golem`
> _Once we got the hang of Golem, it became a valuable help for structuring and maintaining our application._
<!--# ---------------------------------------------------------------------- -->
<!--# SLIDE ---------------------------------------------------------------- -->
<!--# ---------------------------------------------------------------------- -->
## Pros and cons with `golem`
> _Once we got the hang of Golem, it became a valuable help for structuring and maintaining our application._
:::: {.columns}
::: {.column width="45%"}
- Encourages using modules
- Breaks the app into small components
- Helps testing and debugging
- Provides a streamlined and structured workflow
- Removes repetitive coding tasks and lets you focus on app logic and structure
:::
::: {.column width="10%"}
:::
::: {.column width="45%"}
:::
::::
<!--# ---------------------------------------------------------------------- -->
<!--# SLIDE ---------------------------------------------------------------- -->
<!--# ---------------------------------------------------------------------- -->
## Pros and cons with `golem`
> _Once we got the hang of Golem, it became a valuable help for structuring and maintaining our application._
:::: {.columns}
::: {.column width="45%"}
- Encourages using modules
- Breaks the app into small components
- Helps testing and debugging
- Provides a streamlined and structured workflow
- Removes repetitive coding tasks and lets you focus on app logic and structure
:::
::: {.column width="10%"}
:::
::: {.column width="45%"}
- Encourages using modules
- Hard to figure out how to put components together
- Complicated in a small app
- Steep learning curve
- Overwhelming with so many files
- Many functionalities to keep track of
:::
::::
<!--# ---------------------------------------------------------------------- -->
<!--# SLIDE ---------------------------------------------------------------- -->
<!--# ---------------------------------------------------------------------- -->
## Maintaining reproducibility
- Reproducibility is important
- Version control help managing changes
- Show version number in the app
- Hard to keep track of decisions made by the users
- Enforce analysis workflow
<!--# ---------------------------------------------------------------------- -->
<!--# SLIDE ---------------------------------------------------------------- -->
<!--# ---------------------------------------------------------------------- -->
## Other challenges and limitations
- Steep learning curve
- Slow performance with large datasets or many users
- Security issues
- App server required?
- Limited graphical design?
<!--# ---------------------------------------------------------------------- -->
<!--# SLIDE ---------------------------------------------------------------- -->
<!--# ---------------------------------------------------------------------- -->
##
```{r}
#| eval: TRUE
#| echo: FALSE
knitr::include_app("https://shiny.posit.co/r/gallery/", height = 800)
```