I tried one of the R/exams examples posted in the forum and tried to create Moodle questions but I get following error message.
exams2moodle("sample_1.Rnw")
## Error in split.default(solutionlist, gr) : first argument must be a vector.
The same also happens in other exams2xyz()
interfaces.
The example is a cloze question (without solution environment) in Sweave format: sample-1.Rnw
.
\begin{question}
What is the capital of Germany? ##ANSWER1##
What is the population of Germany's capital (in millions)? ##ANSWER2##
\begin{answerlist}
\item Bonn
\item Berlin
\item Munich
\item Hamburg
\item
\end{answerlist}
\end{question}
\exname{German capital}
\extype{cloze}
\exclozetype{schoice|num}
\exsolution{0100|3.669495}
\extol{0.1}
\exshuffle{TRUE}
This problem only occurs in R/exams up to version 2.3-6 (the CRAN release version at the time of writing) in cloze questions without solution environment but with enabled exshuffle
option. The easiest solution is to install version 2.4-0 where the bug has been fixed already.
Alternatively, you could also work around the problem by adding a {solution}
(including a suitable {answerlist}
) or omitting the exshuffle
option. But installing the fixed R/exams version is, of course, preferred.