Skip to contents

Creates an `exam` object.

Usage

exam(
  rmd = NULL,
  examinees = NULL,
  instances_num = 1,
  random = TRUE,
  reorder_exercises = TRUE,
  select_n_exercises = NULL
)

Arguments

rmd

A string representing the path to the Rmd file, the exam template.

examinees

A vector of strings, representing the names of instances to generate.

instances_num

An integer, representing the number of instances to generate if the examinee names are not provided.

random

A boolean, indicating whether to generate instances randomly or sequentially.

reorder_exercises

A boolean, indicating whether to reorder exercises in the exam.

select_n_exercises

An integer, representing the number of exercises to include.

Value

An `exam` object.

Details

A test is based on an Rmd template that has predefined parameters whose values are filled in using the functions of this object. In the `rmd` parameter, we specify the template file.

From the template, we generate multiple instances of the exam. We can specify the instances to generate in two ways: by indicating a vector of examinee names (using the `examinees` parameter) or by specifying the number of instances to generate (using the `instances_num` parameter). If both are indicated, the examinee names take precedence.

We can generate the instances either randomly or sequentially, depending on the instance number we generate. This is controlled by the `random` parameter.

Additionally, in each test, we can include the exercises in the same order as they are defined or in random order. This is indicated by the `reorder_exercises` parameter.

Finally, using the `select_n_exercises` parameter, we can specify the number of exercises to include in each test. From all available exercises, the quantity specified in this parameter will be randomly selected. By default, all defined exercises are included.

Examples


rmd <- system.file("extdata/template01.Rmd", package = "rexer")
ex <- exam(
  rmd = rmd,
  examinees = NULL,
  instances_num = 10,
  random = TRUE,
  reorder_exercises = TRUE,
  select_n_exercises = NULL
)