Conversion of an .Rmd-file
Previous content belongs to internal documentation, has been moved to exams_playground/Dokumentation/coaches_docu.qmd
This page will briefly explain the conversion process.
Basic Method
When a both the .Rmd files and the .R file are set up correctly, one simple run-through of the script creates the exercises.
The .R file contains the code that is used to convert the created .Rmd-files, which contain the questions, into the desire output format, for example pdf, html or xml (for moodle).
For each output format there is a different function in the R/exams
package, each function has many parameters, which allow for customization. Below is an explanation for a very simple and straightforward converison file, but also a more advanced, which has implemented certain options, which enhance the basic functionatlity.
Basic Form
In its most basic form, the script only contains three calls. First library(exams)
, which loads the functions available in the R/exams
package. Secondly one to change the working directly to the folder where the .Rmd-files are stored and lastly the call to an exams2
function.
A script could look like this:
library(exams) #load content
setwd("path/to/Rmd/files") #change working directory
exams2pdf("name_of_file.Rmd") #output: pdf
exams2html("name_of_file.Rmd") #output: html
exams2moodle("name_of_file.Rmd") #ouput: xml for moodle import
A simple template script can be downloaded here:
When creating exercises in the .xml format, they can only be viewed sensibly in Moodle for the most part. In order to avoid unnecessary uploading of (unfinished) files, that are still work in progress, it is advisable to use the html format as a “preview”. The hmtl page will look slightly different compared to the moodle exercises, however it can be useful to check the overall look of the exercise while still creating and altering them.
Advanced Form
There are many ways to optimize the conversion process.
Options Parameters Preview output
One way is to create a system of a conversion script and a config file. This way, the conversion script remains unchanged for runs with different parameters and the desired parameters can be changed in the config file. Possible parameters include:
- Seed
- Input and output directory
- Number of copies of the exercises
- Output type