Site icon R-bloggers

Dynamic Content with RStudio, Markdown, and Marked.

[This article was first published on Christopher Gandrud, 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.

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 their blog: Christopher Gandrud.

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.