Learn R Programming

exams (version 2.4-1)

match_exams_call: Query Information from Last xexams/exams2xyz Call

Description

match_exams_call queries the last call made to xexams (typically through some exams2xyz interface). match_exams_device queries the graphics device used in the last xweave call. match_exams_iteration queries the iteration (within n replications) that is currently processed by xexams.

Usage

match_exams_call(which = 1L, deparse = TRUE)
match_exams_device()
match_exams_iteration()

Arguments

which

integer. Specifies the hierarchy level at which the exams2xyz call should be extracted.

deparse

logical. Should only the deparsed function name be computed (or the entire call)?

Details

The function match_exams_call is useful for determining within an exercise which exams2xyz interface is used in order to behave slightly differently, e.g., for PDF vs. HTML output. (This feature only works from R 3.2.0 onwards.)

Similarly, the function match_exams_device can be used within an exercise to use the same graphics device that xweave is using.

Finally, the function match_exams_iteration can be used to find out which iteration (within n replication) is currently processed by xexams or exams2xyz. This is useful if an exercise wants to iterate through a certain grid of parameter settings.

Examples

Run this code
## call exams2nops
dir.create(tdir <- tempfile())
exams2nops("tstat2.Rmd", dir = tdir)
match_exams_call()

## graphics device used
match_exams_device()

## exams2nops called exams2pdf called xexams:
match_exams_call(which = NULL)

## get full exams2nops call
match_exams_call(deparse = FALSE)

# \donttest{
## but note that convenience wrappers etc. are included
e2n <- function(...) exams2nops(...)
e2n("tstat2.Rmd", dir = tdir)
match_exams_call(which = NULL)
# }

Run the code above in your browser using DataLab