exams (version 2.3-6)

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 = "")

Value

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

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.

See Also

exams2html, exams2pdf, exams2moodle, exams2qti12, exams2qti21, exams2arsnova, exams2nops

Examples

Run this code
## 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...

Run the code above in your browser using DataCamp Workspace