Today we’re very excited to announce RPubs, a free service that makes it easy to publish documents to the web from R. RPubs is a quick and easy way to disseminate data analysis and R code and do ad-hoc collaboration with peers.
RPubs documents are based on R Markdown, a new feature of knitr 0.5 and RStudio 0.96. To publish to RPubs within RStudio, you simply create an R Markdown document then click the Publish button within the HTML Preview window:
RPubs documents include a moderated comment stream for feedback and dialog with readers, and can be updated with changes by publishing again from within RStudio.
Note that you’ll only see the Publish button if you update to the latest version of RStudio (v0.96.230, available for download today).
The markdown package
RStudio has integrated support for working with R Markdown and publishing to RPubs, but we also want to make sure that no matter what tools you use it’s still possible to get the same results. To that end we’ve also been working on a new version of the markdown package (v0.5, available now on CRAN).
The markdown package provides a standalone implementation of R Markdown rendering that can be integrated with other editors and IDEs. The package includes a function to upload to RPubs, but is also flexible enough to support lots of other web publishing scenarios. We’ve been working with Jeff Horner on this and he has a more detailed write-up on the capabilities of the markdown package on his blog.
Gallery of examples
We’ve also published a gallery of example documents on RPubs—the gallery illustrates some of the most useful techniques for getting the most out of R Markdown, and includes the following articles:
- MathJax and Writing Equations
- Dynamic Graphics with the googleVis Package
- Customizing Chunk Options
- Caching Code Chunks
Let us know what additional examples you’d like to see—we’ll be adding more in the weeks ahead.





19 comments
Comments feed for this article
June 4, 2012 at 4:23 pm
Tal Galili
Amazing!
You’ve just made a huge step for R!
I am not sure where this leads us, but to a better world for sure.
Thank you for your amazing work!
June 5, 2012 at 12:31 am
jeromyanglim
This looks great. I’m sure you’re thinking of ways to add features. In particular, a few that come to mind:
* One click to show R Markdown source file (or perhaps an option in the publishing process)
* View statistics
* Ability to easily browse what others are posting
June 5, 2012 at 6:35 am
jjallaire
Yes, we definitely want to build connections back to source. We may do this by (optionally) including the source file in the upload and/or automatically connecting back to the version control representation of the source. We’ll also be working on ways to browse other articles.
J.J.
June 5, 2012 at 1:39 pm
Joe Cheng
Hi Jeromy,
I was thinking originally that showing the R Markdown source would not be that interesting unless the data was available as well, so we’d want to publish either the whole project directory or nothing. But now it looks like our users are putting their data on dropbox, so, hmmm…
Do you have an opinion?
June 6, 2012 at 8:27 pm
jeromyanglim
A few thoughts:
1. Showing markdown source is educational at the very least. People can learn about how the R Markdown language works and how R code chunks are specified. Also sometimes, people hide display of the R code chunks for aesthetic reasons. So having an option to show the source would be helpful there.
2. I imagine a good chunk of the use cases for RPubs would be for very simple examples (e.g., you want to demonstrate an idea on StackExchange or in a comment on a blog; or on some other social network). I imagine for more serious larger projects people may want to host the content on their own blog. Of course, I could be wrong on this front, especially if you grow the features of RPubs to make it even more enticing to post content. Anyway, for simple examples, having easy access to the R Markdown file along with the HTML file might be sufficient. In such examples, data is often either simulated in the file, drawn from a package, or drawn from a weblink, and thus as you say, there are no additional project files.
3. However, longer term, I like the idea of having the option to post accompanying files in the project folder. I can imagine a dialogue box that gives you the option to post other files in the folder.
I really like the idea of a system where someone can post an analysis, and then with a few clicks you can download the analysis, alter it yourself, and post an alternative set of analyses. In some respects, github already provides such features, however, I can see how what you are doing with RPubs could be more aligned with the concept of user-friendly “social data analysis”.
June 5, 2012 at 11:48 pm
Tom
Excellent!
Will this open a whole new can of worms for the R community? I sure hope so!
June 11, 2012 at 5:59 pm
H
Is there a way to pretty print data frames?
June 11, 2012 at 11:11 pm
jjallaire
The xtable package allows you to output HTML tables from data frames however I’m not sure of the extent to which you can control the formatting.
J.J.
July 10, 2012 at 1:22 pm
Roland Kofler
Incredible and easy! Can you set the width of a rpubs document?
July 10, 2012 at 2:26 pm
jjallaire
To affect the document width you’ll need to use CSS. There are two ways to approach this:
- Add inline CSS to your markdown file
- Render the markdown using a custom stylesheet. See this article for more details: http://www.rstudio.org/docs/authoring/markdown_custom_rendering
J.J.
July 11, 2012 at 6:25 am
roland
thank you!
July 20, 2012 at 12:47 pm
rgrannell1
great job on rpubs, you’ve really outdone yourselves. Thanks!
July 24, 2012 at 2:37 pm
Geneorama (@Geneorama)
I thought RStudio was amazing, but RStudio with Knitr is approximately `r formatC(round(runif(1, 1e8, 1e9)), digits=10, big.mark=’,')` times better than RStudio alone!
August 4, 2012 at 2:10 am
Roger Close
Looks very promising, but it would be great if code snippets were text, or otherwise copy-and-pasteable (i.e., not merely images!).
August 4, 2012 at 9:05 am
jjallaire
Hi Roger,
Code snippets are indeed text — which RPub are you having trouble copying from?
J.J.
August 4, 2012 at 9:09 am
Roger Close
Sorry, you’re right, the ones in the user gallery are real text—I was mislead by the few example pages RStudio has put up (explaining how to use math syntax, caching, etc.).
September 13, 2012 at 5:42 am
francesco
hi to all, it’s possible to use the publish button to publish document on our ftp server, nt on rpubs?
September 13, 2012 at 5:55 am
jjallaire
It’s not currently possible to do this but an extensible publish button is definitely something we’d like to add in the future.
February 7, 2013 at 8:03 am
Local News Templates – A Business Opportunity for Data Journalists? « OUseful.Info, the blog…
[...] the data views presented. With the increasing number of workflows available around R, (for example, RPubs, knitr, github, and a new phase for the lab notebook, Create elegant, interactive presentations [...]