exams (version 2.3-6)

exams2canvas: Generation of Exams for Canvas

Description

Automatic generation of exams in QTI 1.2 with some tweaks (still under development) for the learning management system Canvas.

Usage

exams2canvas(file, n = 1L, dir = ".", name = "canvasquiz",
    maxattempts = 1, duration = NULL, points = NULL,
    converter = NULL, ...)

Value

exams2canvas returns a list of exams as generated by xexams.

Arguments

file

character. A specification of a (list of) exercise files.

n

integer. The number of copies to be compiled from file.

dir

character. The default is the current working directory.

name

character. A name prefix for resulting exercises and ZIP file.

maxattempts

integer. The maximum attempts for one question (must be smaller than 100000).

duration

integer. Set the duration of the exam in minutes.

points

integer. How many points should be assigned to each exercise? Note that this argument overules any exercise points that are provided within an "\expoints{}" tag in the .Rnw file. The vector of points supplied is expanded to the number of exercises in the exam.

converter

character passed on to make_exercise_transform_html, indicating the type of converter from LaTeX/Markdown to HTML. Currently, Canvas requires HTML with MathML. Hence, if there are Markdown-based .Rmd exercises, the converter needs to be "pandoc-mathml" (or equivalently "pandoc"). For only LaTeX-based .Rnw exercises "ttm" can be used as an alternative and is currently the default.

...

arguments passed on to exams2qti12. The arguments base64 and eval cannot be modified but are hard-coded internally (for details see below).

Details

exams2canvas is a convenience interface to exams2qti12 for generating QTI 1.2 with some small tweaks for Canvas (https://www.instructure.com/canvas/). The supported exercise types at the moment are num, schoice, mchoice, and string (but not cloze, yet). It is still under development and may change in future versions. Please report any problems to the package maintainer.

The Canvas-specific tweaks include:

  • Canvas necessitates a converter that produces HTML plus MathML. Thus, "pandoc-mathml" (or equivalently "pandoc") can be used or alternatively "ttm" for exams with only R/LaTeX .Rnw exercises.

  • Supplementary files (images, data, ...) must be embedded without Base 64 encoding. Thus, base64 = FALSE is hard-coded internally in exams2canvas.

  • Multiple-choice exercises (referred to as multiple answer questions in Canvas) are always evaluated (aka scored) with partial credits in Canvas. Therefore, eval = list(partial = TRUE, negative = FALSE) is hard-coded internally in exams2canvas. Negative points are not supported in Canvas.

  • The QTI XML file requires a few special tags which are enforced through flavor = "canvas" in exams2qti12.

Technical note: For multiple-choice questions the QTI XML file produced by exams2canvas appears to encode an “all-or-nothing” scheme without partial credits (i.e., partial = FALSE). However, this is necessary for Canvas to recognize the answer alternatives correctly. Despite this, Canvas always applies partial-credit evaluation (as explained above).

See Also

exams2qti12

Examples

Run this code
# \donttest{
## load package and enforce par(ask = FALSE)
library("exams")
options(device.ask.default = FALSE)

## define an exams (= list of exercises)
myexam <- c(
  "boxplots",
  "tstat",
  "ttest",
  "regression",
  "relfreq"
)

## output directory
dir.create(mydir <- tempfile())

## generate .zip with OpenOLAT test in temporary directory
exams2canvas(myexam, n = 3, dir = mydir)
dir(mydir)
# }

Run the code above in your browser using DataCamp Workspace