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_quiz(
  rmds,
  title = paste("Autogenerated quiz", lubridate::format_ISO8601(Sys.time())),
  description = "",
  dry_run = FALSE,
  dry_run_prefix = "",
  shuffle = TRUE,
  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.

description

Quiz description as a single string.

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 description, 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.

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, ...).

Value

Quiz object as documented at https://canvas.instructure.com/doc/api/quizzes.html.

Examples

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