Dynamic Content with RStudio, Markdown, and Marked.

May 15, 2012
By

(This article was first published on Christopher Gandrud, and kindly contributed to R-bloggers)

As Markus Gesmann recently pointed out, the new version of RStudio (0.96) has some really nice features for creating dynamic reports with Yihui Xie’s knitr. You can integrate not just R and LaTeX, but also R and Markdown (as well as some other formats).

If you haven’t used Markdown before, it’s basically a really simplified syntax for writing web content, though it can easily be converted not just to HTML but also LaTeX and other formats with Pandoc.

See this post by Yihui Xie for a discussion of how to make HTML presentations with knitr and Pandoc. These programs make it much easier to create HTML presentations that display interactive R output from packages like googleVis (like I did in an earlier post).

I’ve been using RStudio’s new features in the preview version for a few weeks and it has been really great. It has made creating web content much easier. I’ve even decided to pretty much move my entire introductory data analysis course to the web because I can create lecture notes and assignments with nice syntax highlighting and R output integration (especially interactive output).

I remember a few years ago saying to my PhD supervisor that I thought it would someday be standard for theses to be written in HTML. Maybe I need to revise that slightly: theses may be displayed in HTML, but written in Markdown or (more specifically) MultiMarkdown (which has footnote and BibTeX integration).

Recommendation

A small program I really recommend purchasing if you are using RStudio with Markdown is Marked. RStudio has a Markdown previewer, but its capabilities are a bit limited. Marked gives you nicer previews with multiple styles to choose from, word counts, hyperlink validation, and some other stuff that definitely justifies its $3.99 price.

To use Marked with RStudio just drag the .Rnw or .md file you're working on in RStudio on top of the Marked icon. It will update any time you save or compile the files.

(Oh, note I think Marked is Mac only. Also, I have no affiliation with RStudio or Marked, I just really like them.)

To leave a comment for the author, please follow the link and comment on his blog: Christopher Gandrud.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Tags: , ,

Comments are closed.