Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

include_supplement

Copy (Static) Supplement Files for Inclusion in Exercises


Description

Copy (static) files (e.g., graphics, data sets, etc.) for inclusion as supplements in an exercise.

Usage

include_supplement(file, dir = NULL, recursive = FALSE, target = NULL)

Arguments

file

character. A (vector of) file name(s).

dir

character. The directory where file can be found. If used within the code chunks of exercises, the default is to use the directory in which the exercises are stored.

recursive

logical. Should also sub-directories of dir be searched for file?

target

character. A (vector of) target file name(s), by default taken to be the same as file.

Details

Usually, supplement files are created dynamically within an exercise, e.g., data is simulated and then plotted or stored in a file etc. However, sometimes an exercises wants to include a static supplement file that is available in some directory on the system. Then, the include_supplement is a convenience function that copies such a file from its directory into the supplements of an exercise. Then it can be included/referenced as usual in the question/solution text.

Examples

## The "Rlogo" exercise uses a static image which is provided
## within the "exams" package.
if(interactive()) {
exams2html("Rlogo.Rnw")
}

exams

Automatic Generation of Exams in R

v2.3-6
GPL-2 | GPL-3
Authors
Achim Zeileis [aut, cre] (<https://orcid.org/0000-0003-0918-3766>), Bettina Gruen [aut] (<https://orcid.org/0000-0001-7265-4773>), Friedrich Leisch [aut] (<https://orcid.org/0000-0001-7278-1983>), Nikolaus Umlauf [aut], Mirko Birbaumer [ctb], Dominik Ernst [ctb], Patrik Keller [ctb], Niels Smits [ctb], Reto Stauffer [ctb], Kenji Sato [ctb]
Initial release
2020-04-05

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.