This website is generated using RMarkdown.

RMarkdown is great for creating quick professional looking reports, with embedded R function output with or without the code that created them.

You can schedule reports by scheduling the RMarkdown document like you would any R script.

Options include: PDFs, HTML, MS Word, Slides, books, websites (like this one).

The default RMarkdown document has the below text:

R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

summary(cars)
##      speed           dist       
##  Min.   : 4.0   Min.   :  2.00  
##  1st Qu.:12.0   1st Qu.: 26.00  
##  Median :15.0   Median : 36.00  
##  Mean   :15.4   Mean   : 42.98  
##  3rd Qu.:19.0   3rd Qu.: 56.00  
##  Max.   :25.0   Max.   :120.00

Including Plots

You can also embed plots. For example:

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.

Shiny

Shiny is a web application framework for R, produced by RStudio.

A Shiny app usually has two files, server.R and ui.R. These take care of the web server backend and the HTML frontend, respectivily.

To run a Shiny app you need to have a Shiny server running. RStudio comes with one pre-installed for running your apps locally, but for publishing you will need to install Shiny server or host via shinyapps.io.

Shiny apps use a functionality called reactivity that means that apps can be quick and responsive to changes to inputs. This is one of the best features of Excel, where changing one cell can have consequences throughout the Workbook.

Shiny apps can be tricky to get your head around due to the fact that they have a different work flow from normal R programs. It’s recommended to go through the tutorials online.

Combining RMarkdown and Shiny

A recent development is the ability to put Shiny elements into an RMarkdown document.

These documents, again, need a Shiny server to run, but take advatage of the easy formatting of RMarkdown to present the user interface - server and UI elements sit in the same document.

An example RMarkdown document with a Shiny element taking care of authentication can be found here.