# expar

0th

Percentile

##### Fix Parameters in Dynamic Exercises

Set parameters, defined in the first code chunk of an exercise file, to specific values instead of their definition in the exercise file.

Keywords
utilities
##### Usage
expar(file, …)
##### Arguments
file

character with (path to) an exercise file.

paramters to be fixed within file (or a single list of parameters to be fixed).

##### Details

To set certain parameters that are randomly generated within an exercise file to specific values, a copy of the exercise file is generated in the temporary directory of the R session. In the temporary copy of the exercise file the first assignment to the specified parameter in the first code chunk is replaced with the definition provided in expar.

To work properly, the parameter of interest must be defined with a standard assignment in the first code chunk at the beginning of a line. The original definition of the parameter must be in a single line only (typically using something like sample or runif etc.).

After replacing the code chunk, expar returns the path to the temporary file with the modified exercise. This can then be processed with exams2xyz "as usual".

##### Value

A character string with the file path of the modified exercise.

• expar
##### Examples
# NOT RUN {
## fix parameters "a" and "c" in deriv.Rmd
## (but still generate "b" randomly)

## HTML output
if(interactive()){
exams2html(expar("deriv.Rmd", a = 1, c = 0))
}

## just the question text
x <- xexams(expar("deriv.Rmd", a = 1, c = 0))
writeLines(x[[1]][[1]]\$question)
# }

Documentation reproduced from package exams, version 2.3-6, License: GPL-2 | GPL-3

### Community examples

Looks like there are no examples yet.