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 choice is correct; numeric for slider or numeric

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 create_question_raw().

Value

an object of class 'quizChoice'

an object of class 'quizChoiceNumeric'

an object of class 'quizChoiceSlider'

an object of class 'quizChoiceText'

Functions

Author(s)

Joseph Marlo

George Perrett

See Also

create_question()

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 ')

[Package shinyquiz version 0.0.1 Index]