Learn R Programming

exams (version 2.1-0)

exams2arsnova: Generation of Exam/Quiz Sessions in ARSnova Format

Description

Interface for generating interactive sessions in the JSON format of the audience response system ARSnova.

Usage

exams2arsnova(file, n = 1L, dir = ".", name = "R/exams", sname = NULL, qname = NULL, quiet = TRUE, resolution = 100, width = 4, height = 4, encoding = "", url = "https://arsnova.eu/api", sessionkey = NULL, jsessionid = NULL, active = TRUE, votingdisabled = FALSE, showstatistic = FALSE, showanswer = FALSE, abstention = TRUE, variant = "lecture", ssl.verifypeer = TRUE, fix_choice = FALSE, ...)
make_exams_write_arsnova(url = "https://arsnova.eu/api", sessionkey = NULL, jsessionid = NULL, name = "R/exams", sname = NULL, qname = NULL, active = TRUE, votingdisabled = FALSE, showstatistic = FALSE, showanswer = FALSE, abstention = TRUE, variant = "lecture", ssl.verifypeer = TRUE, fix_choice = FALSE)

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 either display on the screen or the current working directory.
name
character. A name prefix for resulting exercises and RDS file.
sname
character. A vector of length 2 with the session name (maximum of 50 characters) and its abbreviation (maximum of 8 characters). Ignored if the sessionkey of an existing session is supplied and otherwise copied by default from name.
qname
character. A vector of names for each question/exercise in file. By default, the name is used.
quiet
logical. Should output be suppressed when calling xweave and texi2dvi.
resolution, width, height
numeric, passed to xweave.
encoding
character, passed to xweave.
url,sessionkey,jsessionid
character specifying (1) the base URL of the ARSnova API, (2) the 8-digit ARSnova session key, (3) the JSESSIONID cookie of an active ARSnova session. If all are provided all questions are imported directly into the existing ARSnova session. Otherwise, a JSON import file is generated.
active
logical. Should the question be active (i.e., released for students) or locked?
votingdisabled
logical. Should voting be disabled?
showstatistic
logical. Should statistics be shown?
showanswer
logical. Should answers be shown?
abstention
logical. Are abstentions allowed?
variant
character. Should the question be a "lecture" or a "preparation" questions?
ssl.verifypeer
logical. Should SSL certificates be validated when connecting via https?
fix_choice
logical. Should math markup be removed in single and multiple choice lists? (This is may be needed for older ARSnova versions where math markup is rendered in the question itself but not the choice list.)
...
arguments passed on to xexams.

Value

A list of exams as generated by xexams is returned invisibly.

Details

exams2arsnova generates exams in the JSON format for ARSnova using xexams. It proceeds by (1) calling xweave on each exercise, (2) reading the resulting LaTeX code, (3) transforming the LaTeX code to Markdown, and (4) embedding the Markdown code into the JSON format for ARSnova (and optionally imports it into a running ARSnova session). For steps (1) and (2) the standard drivers in xexams are used. For step (3) a suitable transformation function is set up on the fly using make_exercise_transform_pandoc. For step (4) a simple writer function is set up on the fly that embeds the transformed Markdown code into a hard-coded JSON template using toJSON and either writes a single JSON file for each exam or imports these directly into an ARSnova session. When url, sessionkey, and jsessionid are all supplied, curlPerform is used to import tall questions directly into the existing ARSnova session. Otherwise, a JSON file (with a whole session) is written to the disk and then needs to be imported manually into an ARSnova server.

Examples

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

## Not run: 
# ## exams2arsnova can either create text files with JSON data
# exams2arsnova("tstat2")
# 
# ## or directly post this to an active ARSnova session (for which the
# ## server URL, the 8-digit session key, and the JSESSIONID cookie are needed)
# exams2arsnova("tstat2", url = "https://arsnova.eu/api",
#   sessionkey = "49061284", jsessionid = "A5BEFDA4141816BB425F2204A602E4B3")
# ## End(Not run)

Run the code above in your browser using DataLab