June 4, 2012
Announcing The R markdown Package

Many of you have heard about RStudio’s latest release and it’s new R Markdown feature. Today, I’d like to announce the markdown package for R, a tool for converting Markdown documents to HTML, created in collaboration with RStudio. It offers the complete R Markdown feature set available in their best-of-breed IDE, however useRs can integrate markdown into their own toolchain of choice. Before getting into what the package can do, let me first describe the variant of Markdown supported by the package.

R Flavored Markdown, or RFM for short (not RTFM ;)

R Flavored Markdown is a plain-text formatting syntax for creating documents that can be rendered to HTML. In fact it’s like HTML, but simpler. R Flavored Markdown is a variant of original Markdown with a few additional features:

Here’s an example RFM document briefly describing the normal distribution functions of R (taken from the R help page for rnom)

The markdown package

The markdown package renders RFM into HTML via the markdownToHTML function:


By default, the HTML options and Markdown extensions are set to create a single page HTML document that is easily shared with others. This is accomplished by embedding all the CSS, Javascript, and even linked images right into the output file. Scope out the help pages of the markdownHTMLOptions and markdownExtensions functions to learn how you can gain a finer control over the resulting output.

markdownToHTML can accept input from either a file or a text object, and the HTML can either be written to a file (as shown above) or returned as a string. This should provide full flexibility for integrating markdown into various toolchains and computing scenarios.

Other features of the markdown package include:

  • smartypants function for rendering ASCII markup to HTML entities,

  • exported C API from the Sundown library for creating and calling new renderers using the renderMarkdown function, and

  • uploading of HTML files to RPubs, a soon-to-be-announced service from RStudio.

An Example

Here’s the HTML output produced by markdown of that example RFM document I mentioned earlier. I think the results are pretty cool.

9:01am  |   URL: http://tmblr.co/Zf5rDyMkcJAv
(View comments  
Filed under: R rstats 
  1. endopaki reblogged this from jeffreyhorner
  2. endopakistan reblogged this from jeffreyhorner
  3. adamlaiacano reblogged this from jeffreyhorner and added:
    This is a really exciting step towards reproducible research. The markdown code below creates this output: # Normal...
  4. jeffreyhorner posted this
Blog comments powered by Disqus