Create a New Quiz from multiple Rmd files using Canvas LMS API.
Source:R/canvas_new_quiz.R
canvas_create_new_quiz.RdThe 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 = "",
...
)Arguments
- rmds
Either a character vector of file names ending in .Rmd, or a named list of such characters vectors. If
rmdsis 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
descriptionin Classic Quizzes.- ...
Additional New Quiz properties, e.g.
published=TRUE, due_at="2026-06-06 13:00", quiz_settings=list(shuffle_questions=TRUE). See the API docs for details on how to code properties. Classic Quizzes properties are accepted too, , e.g.allowed_attempts = -1, and will be translated to New Quizzes properties.
Value
Quiz object as documented at https://developerdocs.instructure.com/services/canvas/resources/new_quiz_items.
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)
} # }