You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/demos/qwebr-read-only.qmd
+16-8
Original file line number
Diff line number
Diff line change
@@ -36,6 +36,8 @@ cat("Your age is: ", age, fill = TRUE)
36
36
````
37
37
:::
38
38
39
+
## Constraining Modifications
40
+
39
41
We can pair `read-only` with `autorun` to create a constrained example allowing us to focus on a single piece of the code.
40
42
41
43
For example, let's say we want to understand what happens when we increase the number of observations randomly sampled from a normal distribution. We could define two interactive cells:
@@ -51,12 +53,14 @@ Try different values for `n` by modifying the assignment statement.
51
53
```{webr-r}
52
54
#| context: interactive
53
55
#| autorun: true
54
-
# Experiment with different sample sizes and, then,
55
-
# re-run the next code cell.
56
+
# Experiment with different sample sizes by
57
+
# changing the n value and re-running the code
58
+
# cell.
56
59
n <- 100
57
60
```
58
61
59
-
Then, run re-run the graph:
62
+
Then, press "Run Code" to recreate the graph and see how the distribution changed:
63
+
60
64
```{webr-r}
61
65
#| context: interactive
62
66
#| autorun: true
@@ -74,17 +78,21 @@ hist(samples,
74
78
```{webr-r}
75
79
#| context: interactive
76
80
#| autorun: true
77
-
# Experiment with different sample sizes and, then,
78
-
# re-run the next code cell.
81
+
# Experiment with different sample sizes by
82
+
# changing the n value and re-running the code
83
+
# cell.
79
84
n <- 100
80
85
```
81
86
```{webr-r}
82
87
#| context: interactive
83
88
#| autorun: true
84
89
#| read-only: true
85
-
# Experiment with different sample sizes and, then,
0 commit comments