add_choice {shinyquiz} | R Documentation |
Add choices to a quiz question
Description
Add a choice to a quiz question. Used in conjunction with create_question()
to generate a question.
Usage
add_choice(text, correct = FALSE)
add_numeric(correct)
add_slider(min = 0, max = 1, default_position = 0.5, correct)
add_text(correct, exact = FALSE)
Arguments
text |
Text of the choice answer |
correct |
Boolean denoting if this |
min |
the minimum value of the slider range |
max |
the maximum value of the slider range |
default_position |
the default value the slider should take |
exact |
Boolean denoting if the grader should use exact matching. If FALSE, the user's answer will be compared to the correct answer after trimming whitespace, converting to lower case, and normalizing diacritics. If you wish to use your own normalizing function, please see |
Value
an object of class 'quizChoice'
an object of class 'quizChoiceNumeric'
an object of class 'quizChoiceSlider'
an object of class 'quizChoiceText'
Functions
-
add_choice()
: Create a discrete choice -
add_numeric()
: Create a numeric choice -
add_slider()
: Create a slider choice -
add_text()
: Create a free text choice
Author(s)
Joseph Marlo
George Perrett
See Also
Examples
add_choice('39')
add_choice('39', TRUE)
add_slider(0, 1, 0.5, 0.8)
add_text('Correct answer')
q <- create_question(
'My question prompt',
add_choice('39'),
add_choice('41', TRUE)
)
q1_fuzzy <- create_question('My Label', add_text(correct = ' hEllo'))
q1_fuzzy@grader('Héllo ')
q1_exact <- create_question('My Label', add_text(correct = 'hEllo', exact = TRUE))
q1_exact@grader('Héllo ')