background preloader

Publishing

Facebook Twitter

Blog with R Markdown and tumblr: Part II. In Part I of this series I described how to set up your tumblr blog so that you can create posts like those on the example site R Markdown Blog. Now I’ll describe how you can actually create such posts. I’ll be using the RStudio IDE for the desktop in all the steps below, but know that you can use your own version of R and your own editor for steps 1, 2, and 4.

I personaly like the the RStudio knitr integration. It provides a really easy and fast iterative process to quickly edit markdown and render to HTML. Step 1: Install The Latest Version of the R markdown package markdown version 0.5.2 is needed for this process, and since it’s currently not on CRAN (it’s on its way) you will need to get it from github. Install.packages("devtools") library(devtools) install_github("markdown", "rstudio") library(markdown) install.packages("knitr") library(knitr) Step 2: Create a New R Markdown Document In RStudio, click on File -> New -> R Markdown.

Save the file and name it First-Post.Rmd. Step 8: Done! R Style Guide. Big Data, R and SAP HANA: Analyze 200 Million Data Points and Later Visualize in HTML5 Using D3 – Part III. Setkey(baa.hp.daily.flights,Year, Month, DayofMonth, Origin) baa.hp.daily.flights.delayed <- baa.hp[DepDelay>15, list( DelayedFlights=length(DepDelay), WeatherDelayed=length(WeatherDelay[WeatherDelay>0]), AvgDelayMins=round(sum(DepDelay, na.rm=TRUE)/length(DepDelay), digits=2), CarrierCaused=round(sum(CarrierDelay, na.rm=TRUE)/sum(DepDelay, na.rm=TRUE), digits=2), WeatherCaused=round(sum(WeatherDelay, na.rm=TRUE)/sum(DepDelay, na.rm=TRUE), digits=2), NASCaused=round(sum(NASDelay, na.rm=TRUE)/sum(DepDelay, na.rm=TRUE), digits=2), SecurityCaused=round(sum(SecurityDelay, na.rm=TRUE)/sum(DepDelay, na.rm=TRUE), digits=2), LateAircraftCaused=round(sum(LateAircraftDelay, na.rm=TRUE)/sum(DepDelay, na.rm=TRUE), digits=2) ), by=list(Year, Month, DayofMonth, Origin)] setkey(baa.hp.daily.flights.delayed, Year, Month, DayofMonth, Origin) # Merge two data-tables baa.hp.daily.flights.summary <- baa.hp.daily.flights.delayed[baa.hp.daily.flights,list(Airport=Origin, # Merge with weather data sep="-"),"%Y-%m-%d")

How to Make HTML5 Slides with knitr. One week ago I made an early announcement about the markdown support in the knitr package and RStudio, and now the version 0.5 of knitr is on CRAN, so I'm back to show you how I made the HTML5 slides. For those who are not familiar with markdown, you may read the traditional documentation, but RStudio has a quicker reference (see below). The problem with markdown is that the original invention seems to be too simple, so quite a few variants was derived later (e.g. to support tables); that is another story, and you do not need to worry much about it. Before you get started, make sure your knitr version is at least 0.5: # install.packages(c('knitr', 'XML', 'RCurl')) update.packages(ask = FALSE) packageVersion('knitr') >= 0.5 Editor: RStudio You need to install the RStudio preview version to use its new features on markdown support. With this version, you will see an interface like this when you create an R markdown file (File --> New --> R Markdown): Converter: Pandoc Final words.

Fancy HTML5 Slides with knitr and pandoc. Karthik Ram gave an Introduction to R a couple of weeks ago, and I strongly recommend you to take a look at his cool HTML5 slides. I started trying HTML5 slides last year, and now it is difficult for me to go back to beamer, which I have used for a few years for my presenations. It is horrible to see beamer slides everywhere at academic conferences (especially the classic blue themes). You probably have heard of an interesting blog post by Ben Schmidt about ocean shipping animations in the 18th and 19th centuries. I also played with the dataset a little bit, and made some slides named Voyages of Sinbad the Sailor (use Left/Right or Up/Down to navigate). I'm using the development version of knitr, which you can install from Github. Another piece of news which may be a little bit early to announce is the corresponding support in RStudio.

To leave a comment for the author, please follow the link and comment on his blog: Yihui Xie. Interactive HTML presentation with R, googleVis, knitr, pandoc and slidy. Tonight I will give a talk at the Cambridge R user group about googleVis. Following my good experience with knitr and RStudio to create interactive reports, I thought that I should try to create the slides in the same way as well. Christopher Gandrud's recent post reminded me of deck.js, a JavaScript library for interactive html slides, which I have used in the past, but as Christopher experienced, it is currently not that straightforward to use with R and knitr. Thus, I decided to try slidy in combination with knitr and pandoc. And it worked nicely. I used RStudio again to edit my Rmd-file and knitr to generate the Markdown md-file output. Following this I run pandoc on the command line to convert the md-file into a single slidy html-file: pandoc -s -S -i -t slidy --mathjax Cambridge_R_googleVis_with_knitr_and_RStudio_May_2012.md -o Cambridge_R_googleVis_with_knitr_and_RStudio_May_2012.html Et volià, here is the result:

Making interactive slides with Org mode and googleVis in R. There’s been a lot of justifiable excitement in the R community about Yihui Xie’s great work, and most recently the incorporation of his knitr package into the RStudio software. Knitr is seen, justifiably, as a worthy successor to SWeave for dynamic, beautiful report generation.

It is all that, but as an Org mode user, I already have something better than Sweave for both reproducible research and literate programming, which works with more than 30 different computer languages, not just R. This is not to mention the astonishing amount of functionality that Org mode provides for any number of problems. I mean, really: it’s Emacs! (There are probably some great use cases for using knitr together with Org mode, but I haven’t come across any myself.) But then Markus Gesmann wrote a interesting blog post about using knitr and the googleVis package to produce interactive HTML presentations by converting the knit-produced markdown to Slidy, and I wanted to do the same in Org mode.

Interactive presentations with deck.js. Announcing RPubs: A New Web Publishing Service for R. 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. Gallery of examples. 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 Other features of the markdown package include: An Example.

R-Weave