The lowdown on RMarkdown - R Programming tips and tricks

Bcorp Logo

The R programming language (often referred to as "RLang") is becoming increasingly popular as an analytical solution for businesses and institutions around the world. R also has powerful graphical capabilities.

In the past it has been something of a specialist task to get results from R into other formats, that better suit the needs of your organisation. Now integrating R into other workflow and systems is being made simpler with the advent of RMarkdown.

RMarkdown is a simple text-based interface that allows you to combine regular text, graphics and tables with the output from R. You can produce results in several formats, including HTML, PDF and Microsoft Word.

Because RMarkdown handles the conversion to the chosen output format you do not need to learn the complexities of Hyper-Text Markup Language, or LaTeX. This makes things a lot more efficient as RMarkdown is a lot simpler than either! Of course if you do understand HTML and/or LaTeX then you can incorporate additional code to your documents.

With RMarkdown you can integrate R-generated analyses and graphics into reports and other documents. You can also produce presentations in several formats, such as:

  • ioslides
  • Slidy
  • reveal.js
  • Beamer

The RMarkdown files themselves are simple to produce, as they can be written in any text editor. Many people turn to RStudio for producing RMarkdown as it combines a text editor with other tools to help streamline the process of making your RMarkdown text into the output you want.

RMarkdown makes it easy to reproduce analytical results, generated by R code, in your output documents. You can present the details easily and efficiently using a range of tools. The following is a simple example of a regression analysis:


Sum Sq

Mean Sq

F value


























RMarkdown takes care of the basic formatting for you and allows you to focus on producing your report and getting across the message, rather than tinkering with the transfer from R to Word or HTML.

Similarly, with graphics you can focus on the graphic you want right from the RMarkdown document and do not have to step through a complicated process of generating a graphic, exporting it to disk, importing it to a new document. The following box-whisker plot is an example of a graphic generated from R (it is based on the regression results shown earlier):

graph showing data that uses statistical analysis with R and rmarkdown

You have all the control over your graphics that you expect from R, but are able to have the result directed to your HTML, PDF or Word document with minimal fuss.

In the examples shown here the R code is "hidden" but if you need to get technical you can easily show the code, and have some control over the syntax highlighting too.

screengrab of simple Rlang code example

We recognise that your time is valuable so we've put together an introductory course in RMarkdown. In this one-day course you will learn:

  • The basics of Markdown
  • Incorporating R code
  • How to make different documents such as:
    • HTML documents
    • Microsoft Word documents
    • PDF documents
  • How to create presentation output:
    • in HTML5 format
    • in PDF format
    Along the way you will discover various aspects of RMarkdown including:
    • Adding hyperlinks
    • Text formatting styles
    • Using numbered and bullet lists
    • Using graphics
    • Including tables
    • Creating tables of contents
    • Tweaking themes and templates

...In short, we'll help you gain the practical skills to produce a variety of output right away and to incorporate your R output seamlessly into your work.

Share this post on:

We would love to hear from you

Get in touch

or call us on 020 3137 3920

Get in touch