Skip to contents

From an exam object, we generate different instances of the exam to deliver to the individuals being examined. To do this, we need to specify the folder where they will be generated (using parameter `out_dir`), the output format (using parameter `output_format`), the encoding (using parameter `encoding`), and whether we want each exercise to start on a new page, include exercises until the pages are filled, or preserve the definition of the exercise in this regard (using parameter `new_pages` with the values 'all', 'none', or NULL).

Usage

generate_document(ex, out_dir, output_format, encoding, new_pages)

# S3 method for exam
generate_document(
  ex,
  out_dir = NULL,
  output_format = "pdf_document",
  encoding = "UTF-8",
  new_pages = NULL
)

Arguments

ex

An `exam` object.

out_dir

A string indicating the output folder.

output_format

A vector of strings specifying the desired output formats.

encoding

A string specifying the encoding.

new_pages

A string with the values 'all', 'none', or NULL.

Value

An `exam` object.

See also

Other exam definition: exam(), generate_correction_document()

Examples


if (FALSE) {
rmd <- system.file("extdata/template01.Rmd", package = "rexer")
exercises <- system.file("extdata/exercises.csv", package = "rexer")
ex <- exam(
  rmd = rmd,
  examinees = NULL,
  instances_num = 1,
  random = TRUE,
  reorder_exercises = TRUE
) |>
  define_exercises_from_csv(exercises) |>
  generate_document(out_dir = tempdir(), new_pages = 'all')
}