I am working on an interactive module using R-markdown and compiling in HTML. I have been trying to use r/Exams as working with learnr was a super pain in the ass without using a shiny server. I have been testing question creation using a simple example. In a separate .rmd file (called quiz01.Rmd) I have the following:
---
title: "Quiz01"
output:
html_document:
css: "css/styles.css"
---
\```{r echo = FALSE}
library("exams")
\```
Question
========
What is my name?
Answerlist
----------
* Amy
* Betty
* Cara
* Demi
Solution
========
My name is Amy!
Answerlist
----------
* True
* False
* False
* False
Meta-information
================
exname: Bridgekeeper
extype: schoice
exsolution: `\r mchoice2string(solutions)`
exshuffle: 3
Then, in my main document where I would like the question to be asked, I have a code chunk that reads:
\```{r setup, echo = FALSE, message = FALSE, warning = FALSE}
library("exams")
exams2html("quiz01.Rmd")
\```
I have been through lots of examples and have followed them to the best of my knowledge. I think I may be missing something in the set-up or something to get this to run! Any help getting this to work would be great!
Thanks, Amy
UPDATE: Thanks for your feedback!
I am working on an online module for students to explore randomness. Within this, I would like a multiple-choice question that allows them to select an answer, check if it is correct, and then try again if it is not. The question could have 1 correct answer if that is easier than having more than one correct answer. This question would be nested within the rest of the rmd/html file. For example, this would be before the question:
<body>
<ul><li>Discussion time! Before moving on, talk in pairs or groups about the possible flaws with this definition. Can you think of examples when this definition wouldn't work?</li></ul>
</body>
Followed by: Question: So, what do you think might be wrong with the no-pattern definition? (Select all that apply) Answer Options: Long run sequences may contain patterned segments, such as HTHTH in a coin-toss sequence. TRUE Short sequences may be patterned as they aren't usually as representative as long run sequences. TRUE The random device (for example, a coin) remembers what happened previously and knows to make sure no patterns are present in the sequence. FALSE The random device (for example, a coin) does not remember what happened so a pattern cannot be made. FALSE
Then, if a FALSE answer is selected, the following is shown: Not quite! A random device (for example, a coin or spinner) does not remember what happened previously in the sequence but a pattern can still occur! Each outcome is independent so is not affected by the last outcome and has no effect on the next! Try again (Hint: there are two correct options).
Or, if the TRUE answers are selected, the following is shown: If you selected option 1 and 2 - spot on! Short sequences are typically less representative than long sequences. Thinking short run sequences should be representative is a bias called the Representativeness Heuristic. Short sequences can be patterned and still be random!
Again, the second TRUE option could be removed so there is only one option that is correct.
The header for the rmd file is:
---
title: "Defining Randomness"
output:
html_document:
css: "css/styles.css"
---
Hope that clarifies things! Thanks again :)