matrix_to_schoice {exams}R Documentation

Generate Single- and Multiple-Choice Question Lists for Matrix Solutions

Description

Functions for generating single- and multiple-choice question lists for a matrix solution. (Optimized for integer matrices.)

Usage

matrix_to_schoice(x, y = NULL, lower = FALSE, name = "a",
  delta = 0.5, digits = 0)

matrix_to_mchoice(x, y = NULL, lower = FALSE, name = "a",
  comparisons = c("==", "<", ">", "<=", ">="), restricted = FALSE)

det_to_schoice(x, y = NULL, range = NULL, delta = 0.5, digits = 0)

Arguments

x

matrix (correct result).

y

numeric vector (optional) with (potentially) wrong solutions/comparisons.

lower

logical. Should only elements from the lower triangle be assessed?

name

character. Base name for matrix elements.

delta

numeric. Minimal distance between solutions.

digits

integer. Digits that should be displayed.

comparisons

character. Vector of logical comparisons that should be employed.

restricted

logical. Should the result be restricted ot at least one correct and one wrong solution/comparison?

range

numeric vector of length 2 (optional) with range of random wrong solutions.

Details

The function matrix_to_schoice (or equivalently matrix2schoice) can be used for generating a single-choice question list for a correct result matrix x. One element is picked randomly from the matrix and chosen to be the correct solution. Other values from the observed absolute range are used as wrong solutions by default (if y does not provide an alternative list of potential solutions).

The function matrix_to_mchoice (or equivalently matrix2mchoice) can be used for generating a multiple-choice question list for a correct result matrix x. Each item from the question list is a logical comparison of one matrix element with a comparion value. By default the comparisons are picked randomly from the observed absolute range (unless y specifies a different list of comparisons).

The function det_to_schoice (or equivalently det2schoice) can be used for generating a single-choice question list for the determinant of a 2x2 matrix. It has been optimized for matrices with single-digit integer elements. It may not yield very balanced random solutions for other scenarios.

Value

matrix_to_schoice/matrix2schoice returns a list with the following components:

index

numeric vector with matrix index of the correct solution chosen.

name

character with LaTeX code for the correct matrix element chosen.

solutions

a logical vector of length 5 indicating the correct solution,

questions

a character vector of length 5 with question list.

matrix_to_mchoice/matrix2mchoice returns a list with the following components:

solutions

a logical vector of length 5 indicating the correct solution,

questions

a character vector of length 5 with question list.

explanations

a character vector of length 5 with explanations why the solutions are correct or wrong.

det_to_schoice/det2schoice returns a list with the following components:

solutions

a logical vector of length 5 indicating the correct solution,

questions

a character vector of length 5 with question list.

See Also

num_to_schoice

Examples

A <- matrix(c(-9, 0, 5, -2), ncol = 2)
matrix_to_schoice(A)
matrix_to_mchoice(A)
det_to_schoice(A)

B <- matrix(1:9, ncol = 3)
matrix_to_schoice(B)
matrix_to_mchoice(B)

[Package exams version 2.4-0 Index]