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

exams_skeleton

Generate Skeleton for Exams Directory/Script


Description

Generate a directory structure which contains ‘demo-*.R’ scripts along with directories containing all available demonstation exercise ‘.Rnw’ or ‘.Rmd’ files and necessary template files (LaTeX, HTML, or XML).

Usage

exams_skeleton(dir = ".",
  type = c("num", "schoice", "mchoice", "string", "cloze"),
  writer = c("exams2html", "exams2pdf", "exams2moodle",
    "exams2qti12", "exams2qti21", "exams2arsnova", "exams2nops"),
  markup = "markdown", absolute = FALSE, encoding = "")

Arguments

dir

character with path to directory. The default is the current working directory.

type

character vector indicating types of exercises that should be included in the ‘demo.R’ script. By default an example for each type of exercise is included.

writer

character vector indicating the exams2xyz writer functions that should be included in the ‘demo.R’ script. By default an example for each type of writer is included.

markup

character vector indicating whether the example exercises use "latex" markup (.Rnw files) or "markdown" markup (.Rmd files).

absolute

logical. Should the paths in the ‘demo.R’ script be absolute? The default is to use relative paths.

encoding

character specifying the encoding to be used in the exams2xyz writer functions.

Details

exams_skeleton (or equivalently exams.skeleton) creates a directory with several ‘demo-*.R’ scripts illustrating the use of the various exams2xyz interfaces. Subdirectories with copies of all demonstration exercise .Rnw or .Rmd files and templates for different output formats (LaTeX, HTML, or XML) are also created.

This should provide a starting point for users wishing to start their own collection of exercises with exams.

The encoding is not used by default. In principle, it can be set to any value that Sweave can work with in the current locale. If set to "UTF-8" (or "utf8"), or "ISO-8859-1" (or "latin1"), or "ISO-8859-15" (or "latin9"), the LaTeX and/or HTML templates are adapted accordingly. For other encodings the templates may need further touch-ups.

Value

exams_skeleton returns a list of character vectors with the demo scripts invisibly.

See Also

Examples

## output directory (replace this with mydir <- "/path/to/your/directory")
dir.create(mydir <- tempfile())

## create exams skeleton with absolute paths in demo.R
exams_skeleton(dir = mydir, absolute = TRUE)

## look at created files
dir(mydir)
dir(mydir, recursive = TRUE)

## now open demo-all.R or any of the other demo-*.R scripts in your
## favorite R code editor and run the examples...

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.