1

I recently installed the R package exams in order to generate some qti format quizzes for a course I am about to teach, but have been unable to import R markdown files.

I tried with the example file switzerland.Rmd available here: http://www.r-exams.org/templates/switzerland/

Here's the error I am getting when I try to run exams2qti21:

> exams2qti21("../Downloads/switzerland.Rmd")
sh: 1: +RTS: not found
Error: pandoc document conversion failed with error 127

How can I fix this?

I am running R 3.4.4 on Ubuntu Xenial.

user1521655
  • 486
  • 3
  • 17
  • This appears to be a problem with `pandoc` as interfaced through the `rmarkdown` package. Could you say ` rmarkdown:::pandoc()` and verify that the reported path actually exists/works? Possibly a newer pandoc version might be needed or something like this... – Achim Zeileis Jan 08 '19 at 01:03
  • This comment pointed me in the right direction. Turns out the namespace where pandoc was defined was knitr, not rmarkdown, but when I typed `knitr:::pandoc()`, I got the error "Error in knitr:::pandoc() : Please install pandoc first: http://pandoc.org". I used Synaptic to install pandoc, and the command works now! – user1521655 Jan 08 '19 at 17:00
  • @AchimZeileis, would you like to write up an answer that I can mark as the correct answer? – user1521655 Jan 08 '19 at 17:01
  • Thanks! I suspected that this is due to a wrong or missing pandoc installation but wasn't sure. I have expanded my comment into a proper answer now. – Achim Zeileis Jan 08 '19 at 22:54
  • I was going through some old `r-exams` questions to see whether any of them are still open. I noticed that you haven't flagged my response as the correct answer (as you suggested above). Would you please consider doing so? – Achim Zeileis May 28 '20 at 19:15
  • Sorry for not doing so sooner! – user1521655 May 29 '20 at 20:44
  • No worries, thanks for doing so now. – Achim Zeileis May 30 '20 at 01:11

1 Answers1

2

This error does not come from exams itself but from the rmarkdown package which is leveraged by exams to call the pandoc converter (for converting Markdown to HTML in this case). It appears that on your system pandoc is either not installed at all, not in the search path, or not installed correctly.

If pandoc is not installed at all, then you need to install it. On Ubuntu you can use the usual package managers to install it, e.g., sudo apt-get install pandoc or via synaptic etc. If you use RStudio then this also ships with a pandoc binary (at least on Windows) so that you don't need to install it yourself.

To check at which path pandoc is installed (if it is), you can use rmarkdown::pandoc().

Achim Zeileis
  • 15,710
  • 1
  • 39
  • 49