-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnotes.Rmd
More file actions
35 lines (26 loc) · 1.22 KB
/
notes.Rmd
File metadata and controls
35 lines (26 loc) · 1.22 KB
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
---
title: "dev_log"
output: html_notebook
---
# Development log
## 2021-12-06
Rewriting the final-project app with a more reactive design, hopefully significantly improving performance.
Key initial fix: use a reactive variable `click_counter` to record clicks of the `Resample` button, and make the `samp_vals` array dependent on both it and the `input$samp_sd` control, so that the sample gets rebuilt whenever the control changes OR the button is clicked:
```{r, eval=FALSE}
# initialize click_counter; the samp_vals reactive variable will
# react to changes in it and force resample.
click_counter <- reactiveVal(0)
# Increment the click_counter on a click of "Resample"
observeEvent(input$resample, {
click_counter(click_counter() + 1)
})
# Resample the values when the SD control changes, or when click_counter
# changes.
samp_vals <- reactive({
click_counter()
# message("samp_vals called, sd input = ", input$samp_sd)
rnorm(SAMP_MAX, mean = 0, sd = input$samp_sd)
})
```
## 2021-12-09
The rewrite considerably cleaned the code and has a better reactive structure, but unfortunately it didn't increase performance much. Drawing plots takes time, I guess.