question_ui_initialize {learnr}R Documentation

Custom question methods

Description

There are five methods used to define a custom question. Each S3 method should correspond to the type = TYPE supplied to the question.

Usage

question_ui_initialize(question, value, ...)

question_ui_try_again(question, value, ...)

question_ui_completed(question, value, ...)

question_is_valid(question, value, ...)

question_is_correct(question, value, ...)

## Default S3 method:
question_ui_initialize(question, value, ...)

## Default S3 method:
question_ui_try_again(question, value, ...)

## Default S3 method:
question_ui_completed(question, value, ...)

## Default S3 method:
question_is_valid(question, value, ...)

## Default S3 method:
question_is_correct(question, value, ...)

Arguments

question

question object used

value

user input value

...

future parameter expansion and custom arguments to be used in dispatched s3 methods.

Value

learnr question objects, UI elements, results or server methods.

See Also

For more information and question type extension examples, please see the Custom Question Types section of the quiz_question tutorial: learnr::run_tutorial("quiz_question", "learnr").

Examples

q <- question(
  "Which package helps you teach programming skills?",
  answer("dplyr"),
  answer("learnr", correct = TRUE),
  answer("base")
)
question_is_correct(q, "dplyr")
question_is_correct(q, "learnr")


[Package learnr version 0.11.5 Index]