Skip to contents

Define a question and the possible answers. The type of question is deduced.

Usage

define_question(qc, type, question, image, image_alt, answer, ...)

# S3 method for question_category
define_question(
  qc,
  type = "",
  question = "",
  image = "",
  image_alt = "",
  answer = "",
  ...
)

Arguments

qc

A question_category object.

type

A string, question type (if needed).

question

A string, statement of the question.

image

A string, optional, image file to include in the question.

image_alt

A string, description of the image to include in the question.

answer

A string, correct answer to the question.

...

A string, rest of the answers to the question.

Value

A question_category.

Details

If we include an image in the question, we must also include text in the alt field associated with it.

After the correct answer, we can indicate as many answers as we want, if we do not indicate all the parameters, we have to give each answer a parameter name different from the rest of the parameter names.

Examples


qc <- question_category(category = 'Initial test') |>
  define_question(
    question = 'What are the basic arithmetic operations?',
    answer = 'Addition, subtraction, multiplication and division.',
    a_1 = 'Addition and subtraction.',
    a_2 = 'Addition, subtraction, multiplication, division and square root.'
  )