Working with bundled examples
Source:vignettes/working-with-bundled-examples.Rmd
working-with-bundled-examples.RmdThe package includes a small set of self-contained example exercises
in inst/exercises. These are useful for testing a fresh
installation or for bootstrapping your own authoring workflow.
Locate the exercises
example_dir <- system.file("exercises", package = "exams2ilias")
list.files(example_dir, full.names = TRUE)Export one exercise
library(exams2ilias)
outdir <- tempfile("ilias-")
dir.create(outdir)
exams2ilias(
file.path(example_dir, "stats_schoice.Rmd"),
n = 1,
dir = outdir,
name = "stats_schoice",
xmlcollapse = FALSE,
solutionswitch = FALSE
)Export the full set
The helper script generate_examples.R exports each
bundled exercise individually and can also create one combined question
pool.
source(file.path(example_dir, "generate_examples.R"))
outdir <- tempfile("ilias-examples-")
dir.create(outdir)
generate_example_exports(outdir)Adapt an exercise for your own pool
A practical workflow is:
- Start from the closest bundled exercise.
- Replace the statistical scenario and answer logic.
- Keep the metadata structure intact.
- Export one question first and test the import in ILIAS.
- Only then batch-export larger question sets.
This keeps debugging cheap and avoids importing many broken items at once.