Description Usage Arguments Details Value See Also Examples

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

1 2 3 4 5 6 7 | ```
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("==", "<", ">", "<=", ">="))
det_to_schoice(x, y = NULL, range = NULL, delta = 0.5, digits = 0)
``` |

`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. |

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

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.

`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 |

`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 |

`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 |

`questions` |
a character vector of length 5 with question list. |

1 2 3 4 5 6 7 8 | ```
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)
``` |

```
$index
row col
1 1
$name
[1] "$a_{11}$" "$a_{11}= -9$"
$solutions
[1] FALSE FALSE TRUE FALSE FALSE
$questions
[1] "$ 5$" "$-1$" "$-9$" "$ 0$" "$-2$"
$questions
[1] "$a_{12} > 5$" "$a_{22} > -8$" "$a_{21} < 0$" "$a_{11} > -9$"
[5] "$a_{12} > 5$"
$solutions
[1] FALSE TRUE FALSE FALSE FALSE
$explanations
[1] "$a_{12} = 5 \\not> 5$" "$a_{22} = -2$"
[3] "$a_{21} = 0 \\not< 0$" "$a_{11} = -9 \\not> -9$"
[5] "$a_{12} = 5 \\not> 5$"
$solutions
[1] FALSE FALSE FALSE TRUE FALSE
$questions
[1] "$56$" "$-64$" "$-9$" "$18$" "$60$"
$index
row col
2 3
$name
[1] "$a_{23}$" "$a_{23}= 8$"
$solutions
[1] FALSE TRUE FALSE FALSE FALSE
$questions
[1] "$ 4$" "$ 8$" "$ 7$" "$ 9$" "$-3$"
$questions
[1] "$a_{33} \\ge -7$" "$a_{31} \\le 3$" "$a_{13} < 6$" "$a_{22} \\ge -3$"
[5] "$a_{11} > 0$"
$solutions
[1] TRUE TRUE FALSE TRUE TRUE
$explanations
[1] "$a_{33} = 9$" "$a_{31} = 3$" "$a_{13} = 7 \\not< 6$"
[4] "$a_{22} = 5$" "$a_{11} = 1$"
```

exams documentation built on May 13, 2018, 3 a.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.