Skip to contents

Here are some helpful tips if you encounter problems while using library(examiner).

General strategies

Use the provided RStudio templates to help you remember the name and heading level of the Question and Answerlist sections and so on. In RStudio, click File > New File > R Markdown > From Template and look for the ones marked with examiner. That gives you a knittable starting point from which you can make incremental changes.

Initially knit your Rmd files outside of examiner (just press the Knit button with the question file active in RStudio),
then knit your quiz with output: examiner::test_knit,
and only then try examiner::canvas or examiner::wiseflow.

Make backup copies before you revise working parts of your Rmd files.
Tips Use git if you know how, otherwise make copies with meaningful names, see file management for the aspiring programmer.

If your code reads files, set “Knit Directory” to “Document Directory” using the dropdown by the Knit button. In my experience, this will sometimes switch to “Current Directory” by accident, which can be confusing if my quizzes live in subdirectories of my project.

My deadline is tonight and something is not working!!

You can fall back to copy-pasting from the generated HTML files provided your Rmd files will knit outside of examiner. Pressing the Knit button with a question file active will default to output: html_document. Open the generated HTML file in your browser, right-click and “View page source”. Search (Ctrl+F) for some text at the beginning of your question, and copy sections of the HTML code into Canvas or WISEflow.

Both Canvas and WISEflow have a source-code view where you can paste or edit HTML directly.

Canvas HTML source button
Canvas HTML source button
WISEflow HTML source button
WISEflow HTML source button

This way, you’ll be no worse off than you’d be without examiner.

I get an error when knitting a question file

Can it knit using the default output format?

First ensure that your Rmd file will knit separately from the quiz. With the question file active in the Source pane, click the knit button. It should start knitting to HTML. If knitting does not succeed, the problem is independent of examiner.

If you get “file not found”-like errors, see the tip about “Knit Directory” above.

I get an error when knitting a quiz file

Error in yamlParser error

It can happen that knitting fails immediately with an error like this one:

Error in yaml::yaml.load(..., eval.expr = TRUE) : 
  Parser error: while parsing a block mapping at line 1, column 1 did not find expected key at line 4, column 5

That means there is invalid syntax in the YAML header, the lines between --- and --- at the top of the quiz file. YAML is picky about indenting and many other things. Try comparing your YAML header with a working example like the “Canvas gallery” template: RStudio > File > New File > R Markdown > From Template > canvas_gallery

Errors using output: examiner::test_knit

Try knitting the question file directly: Press Knit with the question file active in RStudio. If you get an error, the problem is most likely in the R code in the question file or quiz file. Debug as you would any other Rmd file.

If you do not get an error, proceed to whichever you want of output: examiner::canvas or output::examiner::wiseflow.

Errors using output: examiner::canvas

“Failed to perform HTTP request”/“No host part in the URL”

Knitting to Canvas can only work if you have completed the guide to Canvas Configuration. If you haven’t, the environment variable CANVAS_DOMAIN will be empty, and knitting a quiz will give an error like:

Error in `httr2::req_perform()` at examiner/R/canvas.R:457:3:
! Failed to perform HTTP request.
Caused by error in `curl::curl_fetch_memory()`:
! URL rejected: No host part in the URL

nrow(answers) == nchar(meta$exsolution) is not TRUE

Question/Answerlist must have as many items as there are digits in Meta-information/exsolution.

If you have a Solution/Answerlist, it too must have the same number of items.

Other errors that manifest only with output: examiner::canvas

Make a fresh Rmd using the RStudio template for the same question type. Carefully compare the layout of the headings and answer lists and look for differences.

Errors that manifest only with output: examiner::wiseflow

This usually relates to the environment variables not being set up as described in WISEflow Canvas Configuration.