Last active
May 27, 2022 10:52
-
-
Save lindemann09/0172c16684d85d33c23736a5837bb7ac to your computer and use it in GitHub Desktop.
How to export questions from r/exams to ANS?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Example how to export r/exams questions to ANS | |
| # | |
| # The resulting zip file 'qti4ans.zip' can be imported to ANS via the web interface | |
| # | |
| library(exams) | |
| #' Exporting exams to QTI (QTI 2.1) compatible with ANS | |
| #' | |
| exams2qti4ans <-function(file, name="qti4ans.zip", ...){ | |
| titles = lapply(file, function(x) substr(x, 0, nchar(x)-4)) | |
| mchoice_make <- function(x) { | |
| make_itembody_qti21(shuffle = x$metainfo$shuffle, | |
| enumerate = FALSE)(x) | |
| } | |
| exams2qti21(file=file, | |
| ititle=titles, | |
| mchoice = mchoice_make, | |
| name = name, | |
| converter = "pandoc-mathml", ...) | |
| } | |
| # example using exams2qti4ans | |
| exams2qti4ans(file=c('Question-01.Rmd', 'Question-02.Rmd', | |
| 'Question-03.Rmd', 'Question-04.Rmd')) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment