Title: | Exam Tools for Department of Statistics (c403), Uni Innsbruck |
---|---|
Description: | Support tools for managing lectures and exams at Uni Innsbruck, specifically for automatic generation and evaluation of mathematics and statistics exams. |
Authors: | Achim Zeileis [aut, cre], Nikolaus Umlauf [aut], Reto Stauffer [aut] |
Maintainer: | Achim Zeileis <[email protected]> |
License: | GPL-2 | GPL-3 |
Version: | 0.9-3 |
Built: | 2024-11-21 19:19:22 UTC |
Source: | https://github.com/r-forge/exams |
Unexported legacy interface to exams2nops
with different default
values as used at Uni Innsbruck. Instead it is recommended to use exams2nops
directly.
exams2nops( file, n = 1L, dir = NULL, name = NULL, language = "de", title = "Klausur", course = "", institution = "Universit\\\"at Innsbruck", logo = "uibk-logo-bw.png", date = Sys.Date(), replacement = TRUE, intro = NULL, blank = NULL, duplex = TRUE, pages = NULL, usepackage = NULL, encoding = "", startid = 1L, points = NULL, showpoints = FALSE, reglength = 8L, ... )
exams2nops( file, n = 1L, dir = NULL, name = NULL, language = "de", title = "Klausur", course = "", institution = "Universit\\\"at Innsbruck", logo = "uibk-logo-bw.png", date = Sys.Date(), replacement = TRUE, intro = NULL, blank = NULL, duplex = TRUE, pages = NULL, usepackage = NULL, encoding = "", startid = 1L, points = NULL, showpoints = FALSE, reglength = 8L, ... )
file |
character. A specification of a (list of) exercise files. |
n |
integer. The number of copies to be compiled from |
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. |
language |
character. Path to a DCF file with a language specification.
Currently, |
title |
character. Title of the exam, e.g., |
course |
character. Course number, e.g., |
institution |
character. Name of the institution at which the exam is conducted. |
logo |
character. Path to a logo image. If the logo is not found, it is simply omitted. |
date |
character or |
replacement |
logical. Should a replacement exam sheet be included? |
intro |
character with LaTeX code for introduction text at the beginning of the exam. |
blank |
integer. Number of blank pages to be added at the end. (Default is chosen to be half of the number of exercises.) |
duplex |
logical. Should blank pages be added after the title page (for duplex printing)? |
pages |
character. Path(s) to additional PDF pages to be included at the end of the exam. |
usepackage |
character. Names of additional LaTeX packages to be included. |
encoding |
character, passed to |
startid |
integer. Starting ID for the exam numbers (defaults to 1). |
points |
integer. How many points should be assigned to each exercise? Note that this
argument overules any exercise points that are provided within the |
showpoints |
logical. Should the PDF show the number of points associated with
each exercise (if specified in the Rnw/Rmd exercise or in |
reglength |
integer. Number of digits in the registration ID. The default is 8 and it can be increased up to 10. |
... |
arguments passed on to |
exams2nops
is a convenience interface for
exams2nops
with somewhat different defaults:
German titles/descriptions, Uni Innsbruck logo, replacement sheets enabled,
duplex printing enabled.
A list of exams as generated by xexams
is returned
invisibly.
nops_eval nops_register
## load package and enforce par(ask = FALSE) library("exams") options(device.ask.default = FALSE) ## define an exams (= list of exercises) myexam <- list( "boxplots", c("tstat", "ttest", "confint"), c("regression", "anova"), c("scatterplot", "boxhist"), "relfreq" ) if(interactive()) { ## compile a single random exam (displayed on screen) exams2nops(c("tstat2", "anova", "boxplots")) }
## load package and enforce par(ask = FALSE) library("exams") options(device.ask.default = FALSE) ## define an exams (= list of exercises) myexam <- list( "boxplots", c("tstat", "ttest", "confint"), c("regression", "anova"), c("scatterplot", "boxhist"), "relfreq" ) if(interactive()) { ## compile a single random exam (displayed on screen) exams2nops(c("tstat2", "anova", "boxplots")) }
Old legacy interface for producing QTI 1.2 (rather than QTI 2.1)
exams for OpenOlat at Uni Innsbruck. By now superseded by
exams2openolat
.
exams2olat( file, n = 1L, dir = ".", name = "olattest", maxattempts = 1L, cutvalue = 1000, solutionswitch = FALSE, stitle = "Aufgabe", ititle = "Frage", adescription = "Bitte bearbeiten Sie folgende Aufgaben.", sdescription = "Bitte beantworten Sie folgende Frage.", eval = list(partial = FALSE, negative = FALSE), ... )
exams2olat( file, n = 1L, dir = ".", name = "olattest", maxattempts = 1L, cutvalue = 1000, solutionswitch = FALSE, stitle = "Aufgabe", ititle = "Frage", adescription = "Bitte bearbeiten Sie folgende Aufgaben.", sdescription = "Bitte beantworten Sie folgende Frage.", eval = list(partial = FALSE, negative = FALSE), ... )
file |
list, of |
n |
integer, number of randomized tests to be created (default |
dir |
character, where to store the resulting file(s) (default |
name |
character name of the test/quiz |
maxattempts |
integer, he maximum attempts for one question (must be
smaller than |
cutvalue |
numeric, the cutvalue at which the exam is passed |
solutionswitch |
logical Should the question/item solutionswitch be
enabled? In OLAT this means that the correct solution is
shown after an incorrect solution was entered by an examinee
(i.e., this is typically only useful if |
stitle |
character A title that should be used for the sections. May be a vector of length 1 to use the same title for each section, or a vector containing different section titles. |
ititle |
character A title that should be used for the assessment items. May be a vector of length 1 to use the same title for each item, or a vector containing different item titles. Note that the maximum of different item titles is the number of sections/questions that are used for the exam. |
adescription |
character Description (of length 1) for the overall assessment (i.e., exam). |
sdescription |
character Vector of descriptions for each section. |
eval |
named list, specifies the settings for the evaluation policy,
see function |
... |
forwarded to |
exams2olat
is the old convenience interface to produce QTI 1.2
tests/exams for OpenOlat. It has been superseded by exams2openolat
which offers more options and flexibility.
Unexported legacy interface to exams2openolat
with
slightly different default values as used at the Department of
Statistics, Uni Innsbruck. Instead it is recommended to use
exams2openolat
directly.
exams2openolat( file, n = 1L, dir = ".", name = "olattest", maxattempts = 1, cutvalue = 1000, solutionswitch = FALSE, qti = "2.1", stitle = "Aufgabe", ititle = "Frage", adescription = "", sdescription = "", eval = list(partial = FALSE, negative = FALSE), template = "qti21", ... )
exams2openolat( file, n = 1L, dir = ".", name = "olattest", maxattempts = 1, cutvalue = 1000, solutionswitch = FALSE, qti = "2.1", stitle = "Aufgabe", ititle = "Frage", adescription = "", sdescription = "", eval = list(partial = FALSE, negative = FALSE), template = "qti21", ... )
file |
character. A specification of a (list of) exercise files. |
n |
integer. The number of copies to be compiled from |
dir |
character. The default is either display on the screen or the current working directory. |
name |
character. A name prefix for resulting ZIP and RDS file. |
maxattempts |
integer. The maximum attempts for one question, may also
be set to |
cutvalue |
numeric. The cutvalue at which the exam is passed. |
solutionswitch |
logical. Should the question/item solutionswitch be enabled? |
qti |
character indicating whether QTI |
stitle , ititle , adescription , sdescription
|
character. Descriptions for various titles/descriptions. Defaults to generic German titles. |
eval |
named list. Specifies the settings for the evaluation policy, see function
|
template |
character. The IMS QTI 2.1 template that should be used. In addition
to the default template this can be set to |
... |
arguments passed on to |
exams2openolat
is a convenience interface for
exams2openolat
with somewhat different defaults:
German titles/descriptions, partial credits disabled, solution switch turned off,
large cut value (so that the test cannot be passed), and with fancy
quotes turned off in verbatim R output. Finally, an RDS file is stored
as a by-product containing the xexams
list. This
enables extracting and displaying specific exercises from an online test in R.
A list of exams as generated by xexams
is
returned invisibly.
olat_eval olat_exercise
## load package and enforce par(ask = FALSE) library("exams") options(device.ask.default = FALSE) ## define an exams (= list of exercises) myexam <- list( "boxplots", c("tstat", "ttest", "confint"), c("regression", "anova"), c("scatterplot", "boxhist"), "relfreq" ) ## output directory mydir <- tempdir() ## generate .zip with German OpenOlat exam in temporary directory ## using a few customization options exams2openolat(myexam, n = 3, dir = mydir, maxattempts = 2) dir(mydir)
## load package and enforce par(ask = FALSE) library("exams") options(device.ask.default = FALSE) ## define an exams (= list of exercises) myexam <- list( "boxplots", c("tstat", "ttest", "confint"), c("regression", "anova"), c("scatterplot", "boxhist"), "relfreq" ) ## output directory mydir <- tempdir() ## generate .zip with German OpenOlat exam in temporary directory ## using a few customization options exams2openolat(myexam, n = 3, dir = mydir, maxattempts = 2) dir(mydir)
Unexported legacy interface to evaluate NOPS exams produced with exams2nops
,
and scanned by nops_scan
. Instead it is recommended to use
nops_scan
directly.
nops_eval( register = Sys.glob("*.csv"), solutions = Sys.glob("*.rds"), scans = Sys.glob("nops_scan_*.zip"), points = NULL, eval = exams_eval(partial = FALSE, negative = 0.25), mark = c(0.5, 0.6, 0.75, 0.85), dir = ".", results = "nops_eval", html = NULL, col = hcl(c(0, 0, 60, 120), c(70, 0, 70, 70), 90), language = "de", module = NULL, interactive = TRUE, string_scans = Sys.glob("nops_string_scan_*.zip"), string_points = seq(0, 1, 0.25) ) nops_eval_write_uibk( results = "nops_eval.csv", file = "exam_eval", dir = ".", language = "en", ... ) nops_register( file = Sys.glob("*.xls*"), startid = 1L, tab = !identical(startid, FALSE), pdf = !identical(startid, FALSE), split = NULL, info = NULL, verbose = TRUE, ... )
nops_eval( register = Sys.glob("*.csv"), solutions = Sys.glob("*.rds"), scans = Sys.glob("nops_scan_*.zip"), points = NULL, eval = exams_eval(partial = FALSE, negative = 0.25), mark = c(0.5, 0.6, 0.75, 0.85), dir = ".", results = "nops_eval", html = NULL, col = hcl(c(0, 0, 60, 120), c(70, 0, 70, 70), 90), language = "de", module = NULL, interactive = TRUE, string_scans = Sys.glob("nops_string_scan_*.zip"), string_points = seq(0, 1, 0.25) ) nops_eval_write_uibk( results = "nops_eval.csv", file = "exam_eval", dir = ".", language = "en", ... ) nops_register( file = Sys.glob("*.xls*"), startid = 1L, tab = !identical(startid, FALSE), pdf = !identical(startid, FALSE), split = NULL, info = NULL, verbose = TRUE, ... )
register |
character. File name of a CSV file (semicolon-separated)
of the registered students, e.g., as produced by |
solutions |
character. File name of the RDS exercise file
produced by |
scans |
character. File name of the ZIP file with scanning results
(containing Daten.txt and PNG files) as produced by |
points |
numeric. Vector of points per exercise. By default read from
|
eval |
list specification of evaluation policy as computed by
|
mark |
logical or numeric. If |
dir |
character. File path to the output directory (the default being the current working directory). |
results |
character. Prefix for output files. |
html |
character. File name for individual HTML files, by default
the same as |
col |
character. Hex color codes used for exercises with negative, neutral, positive, full solution. |
language |
character. Path to a DCF file with a language specification.
Currently, |
module |
logical or numeric. Should module marks (in addition to the
exam marks) be computed? If this is numeric, this can be a vector of
two ECTS weights for the written exam and seminar, respectively (by
default equal weights of 0.5 and 0.5 are used). If |
interactive |
logical. Should possible errors in the Daten.txt file by corrected interactively? Requires the png package for full interactivity. |
string_scans |
character. Optional file name of the ZIP file with scanning results
of string exercise sheets (if any) containing Daten2.txt and PNG files as produced
by |
string_points |
numeric. Vector of length 5 with points assigned to string results. |
file |
character. Name of the VIS file with the registration list. |
... |
Further arguments passed on to |
startid |
integer or logical, default |
tab |
logical. Should a tab-separated file with the seat information
be generated for OpenOlat? Defaults to |
pdf |
logical. Should PDF files with participant lists be generated for
printing? Defaults to |
split |
integer. Number of participant lists ordered by seat. |
info |
character. Vector of length 4 with information about the exam: (1) type of exam (GP, LVP, VO, ...), (2) title of exam, (3) date/time (YYYY-MM-DD HH:MM), (4) location/room. By default the information is inferred from the VIS file. |
verbose |
logical. Should information about the registrations be printed to the screen? |
... |
further arguments passed to |
nops_eval
is a companion function for
exams2nops
and nops_scan
.
It calls nops_eval
from the exams package which evaluates
the scanned exams by computing the sums of the points achived and (if desired)
mapping them to marks (and to module marks). Furthermore HTML reports for each
individual student are generated for upload into OpenOlat. In addition to this
function from the exams package, the function adds the marks in the Uni
Innsbruck-specifc format in an Excel spreadsheet.
nops_register
is another companion function for preprocessing the
registration lists that are provided by VIS. The function assigns random seats
for every student and saves the result in both CSV and XLSX format as well as a
tab-separated text file with the seat numbers for import into OLAT. The
underlying workhorse function is read_vis
.
A data.frame
with the detailed exam results is returned
invisibly. It is also written to a CSV file in the current directory, along
with a ZIP file containing the HTML reports (for upload into OLAT), and an XLSX
file (for importing the marks into VIS).
exams2nops
, nops_scan
, nops_eval
, read_vis
Similar to what olat_eval
does but in a more
detailed way. Creates html files for each participant with feedback
about his/her test results (including questions and solutions).
nops_feedback(res, xexam, name = "nops_feedback")
nops_feedback(res, xexam, name = "nops_feedback")
res |
|
xexam |
list as returned from reading the rds file |
name |
character, name of the test, will be used to name the zip archive file and the html files |
Returns the name of the zip file created.
Reto Stauffer
Process data from NOPS evaluation results (via nops_eval
)
for subsequent IRT (item response theory) modeling.
nops_itemresp( eval = "nops_eval.csv", exam = Sys.glob("*.rds"), psychotools = NULL, labels = NULL, ... )
nops_itemresp( eval = "nops_eval.csv", exam = Sys.glob("*.rds"), psychotools = NULL, labels = NULL, ... )
eval |
character. File name of CSV output from |
exam |
character. File name of RDS output from |
psychotools |
logical. Should |
labels |
function for extracting exercise labels from each
|
... |
additional arguments (such as |
nops_itemresp
returns a data frame with several item response
outcomes for each student: solved
indicates whether or not an
exercise was fully solved, partial
whether or not it was at least
partially solved. points
gives the points achieved for each
exercise. The corresponding nsolved
, npartial
, and
npoints
are the sums of these for each student. Moreover,
solved2
, partial2
, and points2
distinguish not only the
exercises within the exam but also the actual source template within each
exercise.
A data.frame
.
nops_eval
Evaluate OLAT exams produced with exams2olat
,
and carried out and exported in (Open)OLAT.
olat_eval(file, plot = TRUE, export = FALSE)
olat_eval(file, plot = TRUE, export = FALSE)
file |
character. Base file name of RDS and XLS file with
exam generated by |
plot |
logical. Should barplots with the aggregated results be displayed on the screen? |
export |
logical. Should detailed questions along with individual results be exported to HTML files in a ZIP archive for convenient import into OLAT? |
olat_eval
is a companion function for exams2olat
.
It evaluates the exams carried out in OLAT for further processing outside
of OLAT (in CSV format) and optionally exports detailed individual HTML
reports (in a ZIP archive) for reimport into OLAT.
A data.frame
with the detailed exam results is returned invisibly.
It is also written to a CSV file in the current directory, along with a ZIP
file containing the HTML reports (for upload into OLAT).
Modifies the names of the variables in the dat.frame
as read from the xlsx file (OpenOLAT). Converts the variable
names to English such that we do no longer have to care about
language in all other methods/functions.
olat_eval_adjust_lang(x)
olat_eval_adjust_lang(x)
x |
|
Input 'x' is the data.frame as read from the xlsx file
which contains user meta information and the detailed information
about the individual questions of the test.
Problem: depending on the user language settings of OLAT the names
and order of the columns differs. This function takes input 'x' and
manipulates the variable or column names in a way that the rest
of the code (olat_eval
) is not language dependent anymore.
tries to guess the language by calling olat_eval_guess_lang
loads the search-replace-data.frame (internally)
search and replace variable names
return input object x
with new varaible names
Note: Even English to English will rename some of the variables.
The function uses the data set olat_eval_lang
which is shipped
with the package (see data("olat_eval_lang")
).
Returns the same data.frame
(same dimension and data)
with adjusted names.
Reto
Takes the results from read_olat_results
and the information
from the rds
file with the individual questions/answers to generate a
zip archive file with individual test results (html file). This zip file
can be used to upload to OLAT.
olat_eval_export( results, xexam, file = "olat_eval.zip", html = "Testergebnisse.html", col = hcl(c(0, 0, 60, 120), c(70, 0, 70, 70), 90) )
olat_eval_export( results, xexam, file = "olat_eval.zip", html = "Testergebnisse.html", col = hcl(c(0, 0, 60, 120), c(70, 0, 70, 70), 90) )
results |
data.frame, results from |
xexam |
list the object loaded from the rds file which contains the individual questions/answers. The length of the list corresponds to the number of randomized tests, each list element contains N elements (N = number of questions) with all the information required to generate the output. |
file |
character, name of the zip flie, the final archive file where to store the exported html files |
html |
character, name of the output files (html files) |
col |
character vector of length |
Return of the zip()
call.
Given a set of character vectors this function tries
to gess the language of the imported file. This allows to
evaluate exams from OpenOLAT in different languages.
Used by olat_eval
to rename the columns
to make the evaluation independent from the language used when
exporting the results via OLAT.
olat_eval_guess_lang(x)
olat_eval_guess_lang(x)
x |
character vector with column names |
Returns the language name ("en"
, "de"
) if
the function is able to guess the language. Else the script will stop.
Reto
Depending on the user profile language settings OLAT exports test results (xlsx file) in differnet languages. To make things easier in the c403 package the variable names are modified using this language search-and-replace data set.
olat_eval_lang
olat_eval_lang
A data frame with a language flag (given your
export was in German, only rows with lang == "de"
will be considered). The two columns search
and
replace
are used for gsub()
(regular expression
string replacement).
Reto Stauffer
Extract (and display) selected exercises from OpenOlat exams
produced with exams2openolat
in order
to see both question and solution.
olat_exercise(x, ..., fixed = TRUE, show = TRUE, mathjax = TRUE)
olat_exercise(x, ..., fixed = TRUE, show = TRUE, mathjax = TRUE)
x |
character or list. Either an OpenOlat exam list as produced
by |
... |
character. Either a single numeric index of the exam to be selected.
Or, alternatively, patterns to be searched for in the question text
of the exams in |
fixed |
logical. Should the search pattern(s) be matched as is? |
show |
logical. Should the exercise(s) found be shown in the browser? |
mathjax |
logical. Should the JavaScript from http://www.MathJax.org/ be included for rendering mathematical formulas? |
olat_exercise
is a companion function for
exams2openolat
. As OpenOlat has no option during an exam
to look at the precise question of a particular student – and more importantly
the corresponding solution – one strategy is to search for particular words,
numbers, or other strings in the database of all questions from an OpenOlat exam.
olat_exercise
goes through all questions in the exam and selects those
question(s) that match(es) the given search patterns. By default the
question(s)/solution(s) are displayed in the browser and returned invisibly.
A list
containing either a single exercise or a list of such
exercises (in case the search patterns do not yield a unique question).
exams2openolat
Similar to what olat_eval
does but in a more
detailed way. Creates html files for each participant with feedback
about his/her test results (including questions and solutions).
For OLAT tests use olat_feedback
,
for nops tests (written tests) use nops_feedback
.
olat_feedback(res, xexam, name = "olat_feedback") olat_feedback_render_one(res, xexam, i, htmlfile = "Result.html", show = FALSE)
olat_feedback(res, xexam, name = "olat_feedback") olat_feedback_render_one(res, xexam, i, htmlfile = "Result.html", show = FALSE)
res |
data.frame, result from olat_eval |
xexam |
list as returned from reading the rds file |
name |
character, name of the test, will be used to name the zip archive file and the html files |
i |
integer, row index (which row in 'x' to render) |
htmlfile |
character, name of the output file |
show |
logical, if set to |
Returns the name of the zip file created.
Reto Stauffer
Get OLAT test results (FIXME: eval support and cloze evaluation). TODO: Write proper documentation.
read_olat_results(file, xexam = NULL)
read_olat_results(file, xexam = NULL)
file |
name of the file ... |
xexam |
... |
...
Read registration lists (for exams or courses) from the Excel export of VIS (which actually may or may not be XLS or HTML files).
read_vis(file, ...) vis_register(file = Sys.glob("*.xls"), subset = TRUE)
read_vis(file, ...) vis_register(file = Sys.glob("*.xls"), subset = TRUE)
file |
character with file name of an XLS file from VIS. |
... |
additional arguments passed to |
subset |
logical. Should students without confirmed registration be omitted? |
VIS offers Excel exports but in case of registration lists these are actually HTML files containing an HTML table. (Note that as of 2021 VIS offers an additional “real Excel” export.) HTMLtables are read using the XML package. However, some exports are also converted to actual Excel files which are read using the xlsx package. In either case some basic cleaning is done and additional meta-information is extracted.
The vis_register
function loops over reading several VIS exports and then
consolidates the resulting data frames.
A data.frame
with an additional attribute "info"
providing
details about the type of course ("LV"
) or exam ("GP"
).
Auxiliary functions for formatting elements of exams.
uibkmark(x, factor = TRUE) mchoice2text( x, true = "\\\\textbf{Richtig}", false = "\\\\textbf{Falsch}" )
uibkmark(x, factor = TRUE) mchoice2text( x, true = "\\\\textbf{Richtig}", false = "\\\\textbf{Falsch}" )
x |
numeric ( |
factor |
logical. Should the result be a factor or a character? |
true |
character. Text for true results. |
false |
character. Text for false results. |
The function uibkmark
maps the numbers 1 to 5 to the mark labels
SGT1, GUT2, etc. as used by UIBK.
The function mchoice2text
masks the exams function of the same name
in order to show German text.
uibkmark(1:5) mchoice2text(c(TRUE, FALSE))
uibkmark(1:5) mchoice2text(c(TRUE, FALSE))
Randomly assign a vector of names (typically obtained from a VIS registration) into groups and display the result as an HTML table.
vis_groups(x, nrow = 5L, ncol = 2L, ...)
vis_groups(x, nrow = 5L, ncol = 2L, ...)
x |
character. Either a vector of names or a file name (csv or xls/xlsx from VIS)
from which the |
nrow , ncol
|
numeric. Number of rows and columns into which the students should be assigned. |
... |
A character vector with the HTML code is returned invisibly.