-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path11_26_24.qmd
267 lines (198 loc) · 6.45 KB
/
11_26_24.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
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
---
title: "R for <br>Authoring!!"
author: "OOH Session #53...<br>...gettin' [Figgie]{.leaflet} with it!!!"
title-slide-attributes:
data-background-image: img/figgie.JPG
data-background-opacity: ".4"
format:
revealjs:
mouse-wheel: true ## yes enables mouse
slide-tone: false
# navigation-mode: vertical
transition: convex
transition-speed: slow
# controls-layout: bottom-right
# controls-tutorial: true
# slide-number: h.v
mermaid:
theme: forest
# output-location: slide ## column-fragment; inserts blank 2nd slide
code-overflow: wrap ## instead of horizontal scroll
theme: [league, weekly.scss] ## night & league
logo: "erg2.png"
footer-logo-link: "https://ergreports.com/" ## https://github.com/shafayetShafee/reveal-header#readme
preview-links: false ## true brings up iframe window instead of "site"
code-annotations: hover
html-math-method:
method: mathjax ## LaTeX in code annotations
url: "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.9/latest.js?config=TeX-MML-AM_CHTML"
engine: knitr ## not picking up inline codes
bibliography: temp.bib
#lightbox: true
filters:
- reveal-header ## extension to add a hyperlink to slide logo
---
```{r, warning=FALSE, message=FALSE}
#devtools::install_github("hadley/emo") ## if anyone else wants to render
library(fontawesome)
```
## Open Office Hours <br>(`r format(Sys.Date(),"%B %d, %Y")`)
::: {layout="[80,20]"}
::: first-column
- Recap session #52 `r emo::ji("left_right_arrow")`
- Focal issue(s):
- [polling]{.election} via `r fontawesome::fa("r-project", fill="#4287f5")`: Part IV
+ [surveydown](https://surveydown.org/) `r emo::ji("down_arrow")`
+ Capturing the [data]{.pmarker}
- Shared problem-solving
:::
::: second-column
:::
:::
![](img/title52.JPG){.absolute top="170" right="-120" width="600" height="325"}
# Recap of Session #52:
## [Polling]{.election} via [Surveydown](https://surveydown.org/) -- Part III...
:::: {.columns}
::: {.column width="15%"}
...the [Shiny]{.shiny2} element:
:::
::: {.column width="85%"}
:::: {.panel-tabset}
## .qmd spex
```
---
echo: false
warning: false
theme: [league, weekly.scss] ## night & league
---
``{r, echo=FALSE}
library(surveydown)
``
![](https://upload.wikimedia.org/wikipedia/en/thumb/e/e4/Woody_Woodpecker.svg/1200px-Woody_Woodpecker.svg.png){.absolute height="100"}
::: {#welcome .sd-page}
# Welcome to our survey!
$I_i(\theta)=a^{2}_iP_i(\theta)Q_i(\theta)$
[This is a simple demonstration of a `surveydown` survey. It has two pages with one question on each page.]{.kulas3}
Here is a basic "multiple choice" question, created using `type = 'mc'` inside the `sd_question()` function:
``{r}
#| echo: false
sd_question(
type = 'mc',
id = 'penguins',
label = "$I_i(\\theta)=a^{2}_iP_i(\\theta)Q_i(\\theta)$",
option = c(
'Adélie' = 'adelie',
'Chinstrap' = 'chinstrap',
'Chilly Willy' = "chilly",
'Downy WP' = 'woody',
"Gentoo" = 'gentoo'
)
)
``
You need to insert next buttons with `sd_next()` and set the `next_page` argument to the name of the page you want to go to next.
``{r}
sd_next(next_page = 'page2')
``
:::
::: {#page2 .sd-page}
This is another page in your survey.
{surveydown} supports many types of questions. For example, here is a simple `text` type question:
``{r}
sd_question(
type = "text",
id = "silly_word",
label = "Write a silly word here:"
)
sd_next(next_page = 'end')
``
:::
``{r}
sd_question(
type = 'slider',
id = 'climate_care',
label = "To what extent do you believe human-caused climate change is real?",
option = c(
"Don't Believe" = "dont_believe",
"Somewhat Believe" = "somewhat",
"Neutral" = "neutral",
"Believe" = "believe",
"Strongly Believe" = "strongly_believe"
)
)
``
``{r}
sd_question(
type = 'mc_buttons',
id = 'fruit',
label = "Which fruit do you prefer most from this list?",
option = c(
"Apple" = "apple",
"Banana" = "banana",
"Pear" = "pear",
"Strawberry" = "strawberry",
"Grape" = "grape",
"Mango" = "mango",
"Watermelon" = "watermelon"
)
)
``
::: {#end .sd-page}
## End
This it the last page in the survey.
``{r}
sd_close("Exit Survey")
``
:::
```
## Preview
{{< revealjs file="survey.html" height="500px" class="ratio ratio-16x9" full-screen-link="false">}}
## [Shiny]{.shiny2} spex
```{r}
#| eval: false
#| echo: true
# remotes::install_github("surveydown-dev/surveydown", force = TRUE)
library(surveydown)
# Database setup
# surveydown stores data on a database that you define at https://supabase.com/
# To connect to a database, update the sd_database() function with details
# from your supabase database. For this demo, we set ignore = TRUE, which will
# ignore the settings and won't attempt to connect to the database. This is
# helpful for local testing if you don't want to record testing data in the
# database table. See the documentation for details:
# https://surveydown.org/store-data
db <- sd_database(
host = "",
dbname = "",
port = "",
user = "",
table = "",
ignore = TRUE
)
# Server setup
server <- function(input, output, session) {
# Define any conditional skip logic here (skip to page if a condition is true)
sd_skip_if()
# Define any conditional display logic here (show a question if a condition is true)
sd_show_if()
# Database designation and other settings
sd_server(
db = db
)
}
# shinyApp() initiates your app - don't change it
shiny::shinyApp(ui = sd_ui(), server = server)
# viola
```
::::
:::
::::
![](https://surveydown.org/images/technologies.png){.absolute right="-130" top="0" height="200"}
![](https://static.vecteezy.com/system/resources/thumbnails/015/241/249/small/glowing-neon-arrow-doodle-transparent-free-png.png){.absolute right="20" top="65" width="100"}
# Today...
## [surveydown](https://surveydown.org/) Part IV -- Capturing the [data]{.pmarker}:
![](https://surveydown.org/images/technologies.png){.absolute left="100" height="600"}
![](https://static.vecteezy.com/system/resources/thumbnails/015/241/249/small/glowing-neon-arrow-doodle-transparent-free-png.png){.absolute left="470" bottom="170"}
## `r fontawesome::fa("r-project", fill="#4287f5")` Session Info (`r format(Sys.Date(),"%B %d, %Y")`) Rendering:
```{r}
sessionInfo()
```