Create a quiz question from a library(exams) Rmd file using the Canvas LMS API.
Source:R/canvas_create_question.R
canvas_create_question.Rd
Create a quiz question from a library(exams) Rmd file using the Canvas LMS API.
Usage
canvas_create_question(
rmd,
quiz_id = NULL,
dry_run = FALSE,
abstain = NULL,
allow_dups = FALSE,
quiz_title = "New Quiz",
quiz_shuffle = TRUE,
...
)
Arguments
- rmd
Path to R markdown file defining the question, OR a single string which will become a text_only_question as a kind of section heading.
- quiz_id
Quiz to add the question to (leave blank for new).
- dry_run
Set to TRUE to make a practice version of any file upload or essay questions, replacing them with a "text only question" so that manual grading won't be required. Defaults to 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
- quiz_title
Title for new quiz to be created if
quiz_id
is NULL. Ignored ifquiz_id
is given.- quiz_shuffle
Whether to set shuffle=TRUE for new quiz. Ignored if
quiz_id
is given.- ...
If
quiz_id
is NULL,...
arguments are passed tocanvas_create_quiz()
.
Value
A list containing the following elements:
quiz_id
: The ID of the updated or newly created quiz.html_url
: The URL to access the updated quiz online.question_id
: The ID of the newly added question.points_possible
: The total points possible for the newly added question.
Examples
if (FALSE) { # \dontrun{
rmd <- system.file("multiple_choice_question.Rmd", package = "examiner", mustWork = TRUE)
canvas_create_question(rmd)
} # }