render

0th

Percentile

Render R Markdown

Render the input file to the specified output format using pandoc. If the input requires knitting then knit is called prior to pandoc.

Usage
render(input, output_format = NULL,
       output_file = NULL, output_options = NULL,
       clean = TRUE, envir = parent.frame(), quiet = FALSE,
       encoding = getOption("encoding"))
Arguments
input

Input file (Rmd or plain markdown)

output_format

R Markdown output format to convert to. This can be a character vector with the name of a format; e.g. "html_document". Alternatively it can be an output format object; e.g. html_document(). If NULL is passed then the output format is read from the YAML metadata within the input file (defaulting to HTML if no format is specified in metadata).

output_options

List of output options that can override the options specified in metadata (e.g. could be used to force self_contained or mathjax = "local"). Note that this is only valid when the output format is read from metadata (i.e. not a custom format object passed to output_format)

output_file

Output file (if not specified then a default based on the specified output format is chosen)

clean

TRUE to clean intermediate files created during rendering.

envir

The environment in which the code chunks are to be evaluated during knitting (can use new.env() to guarantee an empty new environment)

quiet

TRUE to supress printing of the pandoc command line

encoding

the encoding of the input file; see file

Details

If no output_format parmaeter is specified then the output format is read from the YAML front-matter of the input file. For example, the following YAML would yield a PDF document:

output: pdf_document

Additional format options can also be specified in metadata. For example:

output:
  pdf_document:
    toc: true
    highlight: zenburn

Multiple formats can be specified in metadata. If no output_format is passed to render then the first one defined will be used:

output:
  pdf_document:
    toc: true
    highlight: zenburn
  html_document:
    toc: true
    theme: united

Formats specified in metadata can be any one of the built in formats (e.g. html_document, pdf_document) or a format defined in another package (e.g. pkg::custom_format).

If there is no format defined in the YAML then html_document will be used.

Value

The compiled document is written into the output file, and the path of the output file is returned.

R Markdown

R Markdown supports all of the base pandoc markdown features as well as some optional features for compatibility with GitHub Flavored Markdown (which previous versions of R Markdown were based on). See rmarkdown_format for details.

See Also

knit, output_format, pandoc

Aliases
  • render
Documentation reproduced from package rmarkdown, version 0.1.2, License: GPL-3

Community examples

Looks like there are no examples yet.