Announcing The R markdown Package

[This article was first published on Jeffrey Horner, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

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:

markdownToHTHML(‘R-normal-dist-functions.md’,’R-normal-dist-functions.html’)

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.

To leave a comment for the author, please follow the link and comment on their blog: Jeffrey Horner.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)