Sys.getenv("QUARTO_PROFILE")
[1] "book"
Instructions from this presentation.
Install the webR Quarto extension:
quarto add coatless/quarto-webr
Add the webR filter to the yaml:
format: revealjs
filters:
- webr
Add a webR code block:
```{webr-r}
# set a random seed and generate data
set.seed(123)
x <- rnorm(100)
# calculate mean
mean(x)
```
Shiny Live allows either R or Python shiny apps to be run from within the book - without storing the book on a shiny server! See here for a tutorial.
Every time the user opens your book, the shiny app installs all of the required packages. For best results, keep packages to a minimum.
(This repo does not have an example because the extension adds dependencies. I’ll maybe make another repo just to outline the steps I needed to take.)
In my slides, I include something like:
## Q1
Which of the following statements is *False*?
a. True
b. False
<!--- B --->
A custom R script extracts the “B” from the comment string, then formats an MC question according to my LMS.
The question is shown only on the slides, students answer on the LMS.
This is specific to the way I do things, but it has saved quite a bit of time and lets me do quizzes tied to their student numbers without an external tool.
Sys.getenv("QUARTO_PROFILE")
[1] "book"
Using the profile in R:
<- function(x) {
blank if(Sys.getenv("QUARTO_PROFILE") == "book") {
return(x)
else {
} return("________")
} }
Forgetful Sally was so forgetful that when she tried to remember something she drew a blank.
How can I get an arbitrary block of text to be hidden until the user asks for it?
<details>
<summary>**Solution**</summary>
</details>
You can have a separate repo that is private (e.g., if it has quizzes with solutions), then include files from that repo.