Description Usage Arguments Details
View source: R/multiple_choice.R
Shortcuts for fixed-choice questions
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | true_or_false(
prompt,
right_answer,
message_right = "You got that right!",
message_wrong = "Sorry, you missed.",
points = NA,
allow_retry = TRUE,
show_answers = are_answers_on(),
is_learnr = "learnr" %in% loadedNamespaces()
)
choose_one(
prompt = "First consonant?",
choices = list(a = "No, it's not", `+b+` = "Right as rain"),
inline = TRUE,
points = NA,
show_answers = are_answers_on(),
...,
random_answer_order = TRUE,
allow_retry = TRUE,
is_learnr = "learnr" %in% loadedNamespaces()
)
|
prompt |
Character string prompt for the question |
points |
Integer number of 'grade points' to associate with the question. Optional. |
allow_retry |
Logical flag to allow multiple submissions |
is_learnr |
Is the document being compiled for |
choices |
A character vector of the choices. Correct choices
should be indicated by putting |
inline |
Logical flag. If true, lay out the choices horizontally. |
random_answer_order |
Logical flag to shuffle the order of choices when question is displayed. |
The functions true_or_false()
and choose_one()
are intermediaries
to the learnr::question()
and learnr::answer()
functions. They
provide a somewhat more concise way of describing the choices and appropriate
feedback and they allow questions to be rendered in an ordinary
Rmarkdown document without requiring the "shiny" elements of a learnr
document.
When a etude
file intended to be used with learnr
is compiled on its
own, it is setup for the learnr
runtime and questions will render
in learnr format. (Unless you manually override this with the is_learnr = FALSE
option.)
But when you include an etude file as a child of a mother document, using
the include_etude()
function typically, the questions will inherit
the settings of that document, which might be an ordinary Rmd document
directed to HTML or PDF or Word, etc.
Whether answers are displayed in the non-learnr static renderings
depends on the argument show_answers
. By default, this uses etude
's system
for turning on and off answers with the show_answers(TRUE)
or show_answers(FALSE)
command
earlier in the document.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.