Description Usage Arguments Details Examples
Randomize quiz questions
1 | randomize_quiz(data, id = NULL, randomize_choices = FALSE, n_questions = NULL)
|
data |
A data.frame with questions and possible answers |
id |
An optional ID column. If |
randomize_choices |
Logical, if |
n_questions |
The total number of questions to sample. If |
Assumes that there is one line per question and that the question column is
named "Question"
and that answers begin with "Answer"
.
1 2 3 4 5 6 7 8 9 10 11 12 13 | example_quiz <- data.frame(
Question = c("First question?", "Second question?",
"Third question?", "Fourth question?"),
Answer_A = c("A", "1", "A1", "1A"),
Answer_B = c("B", "2", "B2", "2B"),
Answer_C = c("C", "3", "C3", "3C"),
Answer_D = c("D", "4", "D4", "4D")
)
randomize_quiz(example_quiz)
randomize_quiz(example_quiz, randomize_choices = TRUE)
randomize_quiz(example_quiz, n_questions = 2)
randomize_quiz(example_quiz, n_questions = 0.80)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.