Learn R Programming

rapport (version 1.1)

rapport.example: Template Examples

Description

Displays template examples defined in Example section. Handy to check out what template does and how does it look like once it's rendered. If multiple examples are available, and index argument is NULL, you will be prompted for input. If only one example is available in the header, user is not prompted for input action, and given template is evaluated automatically. At any time you can provide an integer vector with example indices to index argument, and specified examples will be evaluated without prompting, thus returning a list of rapport objects. Example output can be easily exported to various formats (HTML, ODT, etc.) - check out documentation for rapport.export for more info.

Usage

rapport.example(fp, index = NULL, env = .GlobalEnv)

Arguments

fp

a template file pointer (see rapport:::rapport.read for details)

index

a numeric vector indicating the example index - meaningful only for templates with multiple examples. Accepts vector of integers to match IDs of template example. Using 'all' (character string) as index will return all examples.

env

an environment where example will be evaluated (defaults to .GlobalEnv)

Examples

Run this code
# NOT RUN {
rapport.example('Example')
rapport.example('Example', 1:2)
rapport.example('Example', 'all')
rapport.example('Crosstable')
rapport.export(rapport.example('Crosstable'))
# }

Run the code above in your browser using DataLab