Skip to contents

See the example Rmd files for the various question types on how to specify stimulus text and answer options, and to see where HTML is permitted.

Usage

parse_question(
  rmd,
  ignore_images = FALSE,
  url_prefix = NULL,
  remote_dir = NULL,
  self_contained = FALSE,
  parent_folder_path = NULL,
  abstain = NULL
)

Arguments

rmd

Name of R markdown file.

ignore_images

Set this to TRUE to not copy generated or local images to a web server. Any such images will appear broken on import, and you must manually replace them.

url_prefix

URL to root path on server, e.g. "https://example.org/~user/doc" Required to use images with WISEflow.

remote_dir

Optional scp destination path, e.g. "user@server.example.org:~/public_html/doc"

self_contained

Whether to render images inline (data URIs) or in external files (the default)

parent_folder_path

Optional parent folder path for images in Canvas

abstain

Text for an optional extra option (!) like "I wish to leave this question unanswered". Relevant where the exam system does not allow a test-taker to unselect all options.

Value

List representing a question of the given type according to https://canvas.instructure.com/doc/api/quiz_questions.html

Details

If there are images in the question:

When targeting Canvas, images will be uploaded using the Canvas Files API. You may optionally specify a parent_folder_path, default is the Files root.

When targeting WISEflow, you have three options:

  • Specify url_prefix and remote_dir to have images uploaded to a web server. See ?wiseflow_images for details.

  • Specify url_prefix and manually move images to the web server.

  • Set ignore_images=TRUE. Then images will be broken in WISEflow, but you can manually insert them later.

Examples

examiner:::parse_question(system.file("multiple_choice_question.Rmd",
                                      package = "examiner", mustWork = TRUE))
#> $question_text
#> [1] "<p>This is a <strong>Multiple Choice</strong> question (multiple_choice_question).</p>\n<p>What is the colour of blood?</p>"
#> 
#> $question_type
#> [1] "multiple_choice_question"
#> 
#> $points_possible
#> [1] 1
#> 
#> $shuffle
#> [1] FALSE
#> 
#> $answers
#> $answers[[1]]
#> $answers[[1]]$answer_html
#> [1] "<div>Red</div>"
#> 
#> $answers[[1]]$answer_weight
#> [1] 100
#> 
#> 
#> $answers[[2]]
#> $answers[[2]]$answer_html
#> [1] "<div>White</div>"
#> 
#> $answers[[2]]$answer_weight
#> [1] 0
#> 
#> 
#> $answers[[3]]
#> $answers[[3]]$answer_html
#> [1] "<div>Blue</div>"
#> 
#> $answers[[3]]$answer_weight
#> [1] 0
#> 
#> 
#> 
#> $meta
#> $meta$extype
#> [1] "multiple_choice_question"
#> 
#> $meta$exsolution
#> [1] "100"
#> 
#> 
if (FALSE) { # \dontrun{
examiner:::parse_question(
  rmd = system.file("multiple_penguin_question.Rmd", package = "examiner", mustWork = TRUE),
  url_prefix = "https://example.org/~user/test",
  remote_dir = "user@server.example.org:~/public_html/test")
} # }