Skip to contents

Choose correct and incorrect answers and format them for r/exams files.

Usage

build_choices(question_row, nchoices, ncorrect = 1)

Arguments

question_row

Single row of data. See build_question_df().

nchoices

Total number of choices to give students.

ncorrect

Number of choices that are correct (default: 1). 0 <= ncorrect <= nchoices

Value

Named list with two string values:

  1. answerlist: Bulleted list with all possible choices.

  2. exsolution: Binary representation of the correct answer(s).

N Correct

By default, ncorrect is set to 1. A warning will be thrown if ncorrect is greater than nchoices.

To have a random number of correct answers, set ncorrect to NA, "random", or a vector of two numbers. NA and random will set ncorrect to a random number between 1 and ncorrect, inclusively. Providing a vector of two numbers will set ncorrect to a random number between those two numbers, inclusively.

Credits

Brighton Pauli, 2023