Skip to contents

The format of the Rmd files is based on that of library(exams), with extensions for more question types and for feedback for each answer option.

Usage

canvas_create_new_quiz(
  rmds,
  title = paste("Autogenerated quiz", lubridate::format_ISO8601(Sys.time())),
  instructions = "",
  dry_run = FALSE,
  dry_run_prefix = "",
  shuffle = TRUE,
  shuffle_answers = shuffle,
  shuffle_questions = FALSE,
  published = FALSE,
  abstain = NULL,
  allow_dups = FALSE,
  ...
)

Arguments

rmds

Either a character vector of file names ending in .Rmd, or a named list of such characters vectors. If rmds is a list, "text only" questions with the list's names will be inserted before each group of questions.

title

Quiz title, not visible to students, but useful when browsing to compose quizzes.

instructions

Quiz instructions as a single string. Same as description in Classic Quizzes.

dry_run

Set to TRUE to make a practice version of a quiz, replacing any file upload or essay questions with "text only question" so that manual grading won't be required. Defaults to FALSE.

dry_run_prefix

String to be prepended to the quiz instructions, explaining that this is a dry run quiz. Ignored if dry_run = FALSE.

shuffle

Whether to shuffle answer options (applies to the entire quiz). Default TRUE. Note that WISEflow and Canvas both default to FALSE.

shuffle_answers

Alias of shuffle.

shuffle_questions

Whether questions should be shuffled during quiz. Default FALSE. Note that this feature is not available in Canvas Classic Quizzes.

published

Whether the quiz should be published after creation (default FALSE).

abstain

Optional text for a zero-score answer alternative like "I wish to leave this question unanswered". This is relevant where wrong answers give a negative score, because Canvas offers no way to untick a radio button without selecting another.

allow_dups

Allow duplicate answer alternatives (default FALSE). This catches problems where answer alternatives print identically after roundoff. You might occasionally want to enable duplicate options for comic effect: What's the magic word? 🔘 git 🔘 git 🔘 git

...

Additional Question properties, e.g. allowed_attempts = -1, ...).

Examples

if (FALSE) { # \dontrun{
rmds <- system.file(c("multiple_choice_question.Rmd",
                      "xhtml-features-wiseflow.R"),
                    package = "examiner",
                    mustWork = TRUE)
quiz <- canvas_create_new_quiz(rmds)
quiz$id
browseURL(quiz$html_url)
} # }