Learn R Programming

exams (version 2.4-1)

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

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, ignored. The encoding is always assumed to be UTF-8.

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.

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 DataLab