+ - 0:00:00
Notes for current slide
Notes for next slide

Communicating with Data
via R Markdown



R Markdown Basics

Presented by Emi Tanaka

School of Mathematics and Statistics


dr.emi.tanaka@gmail.com @statsgen

4th October 2019 | COMBINE | Sydney, Australia

These slides are viewed best by Chrome and occasionally need to be refreshed if elements did not load properly. See here for PDF .

1/16

Hi! I'm Emi! 👋


I'm a lecturer in statistics at The University of Sydney (soon moving to Monash University).


Introduce yourself to someone you don't know!

03:00
2/16

HELP!

Please send SOS signal by attaching sticky note on your laptop.


Please help your neighbours 🙏

3/16

Open

http://bit.ly/rmd-combine-2019


and save a permanent copy to your RStudio Cloud account.

4/16

Schedule


Time Activity
1:00PM - 1:25PM Session 1: R Markdown Basics
1:25PM - 1:30PM Break 🍵
1:30PM - 3:00PM Session 2A: Reproducible Reports I
3:00PM - 3:30PM Afternoon Tea ☕🍰
3:30PM - 4:10PM Session 2B: Reproducible Reports II
4:10PM - 4:15PM Break 🚽
4:15PM - 5:00PM Session 3: Pretty Presentations
5/16

R Markdown Basics

6/16

Knitting: Rmd    md    html

7/16

Knitting: Rmd    md    pdf

8/16

There are many other output formats possible with R Markdown via Pandoc.

Can you name another 3?

9/16

R Markdown under the hood: html_document

knitr 📦 does the hard work of converting Rmd    md

---
title: "My Report"
output: html_document
---
# Hello
```{r}
1 + 1
```
---
title: "My Report"
output: html_document
---
# Hello
```r
1 + 1
```
```
## [1] 2
```
Rmd
md
10/16

R Markdown under the hood: html_document

Then rmarkdown 📦 prepares md for pandoc to convert to html .

---
title: "My Report"
output: html_document
---
# Hello
```r
1 + 1
```
```
## [1] 2
```
<body>
<div class="container-fluid main-container">
<div class="fluid-row" id="header">
<h1 class="title toc-ignore">My Report</h1>
</div>
<div id="hello" class="section level1">
<h1>Hello</h1>
<pre class="r"><code>1 + 1</code></pre>
<pre><code>## [1] 2</code></pre>
</div>
</div>
</body>
This html file is missing some elements due to restriction of space.
md
html
11/16

R Markdown under the hood: pdf_document

Same as before: knitr 📦 converts Rmd    md

---
title: "My Report"
output: pdf_document
---
# Hello
```{r}
1 + 1
```
---
title: "My Report"
output: pdf_document
---
# Hello
```r
1 + 1
```
```
## [1] 2
```
Rmd
md
12/16

R Markdown under the hood: pdf_document

Then rmarkdown 📦 prepares md for pandoc to convert to tex pdf .

---
title: "My Report"
output: html_document
---
# Hello
```r
1 + 1
```
```
## [1] 2
```
\begin{document}
\maketitle
\hypertarget{hello}{%
\section{Hello}\label{hello}}
\begin{Shaded}
\begin{Highlighting}[]
\DecValTok{1} \OperatorTok{+}\StringTok{ }\DecValTok{1}
\end{Highlighting}
\end{Shaded}
\begin{verbatim}
## [1] 2
\end{verbatim}
\end{document}
md
tex
This tex document is missing elements before \begin{document} due to restriction of space.
13/16

Get started with

challenge-01.Rmd

05:00
14/16

Advanced question

How do you render different output formats at once?

15/16

That's it!

These slides are made using xaringan R-package.

The workshop materials are licensed under .



Emi Tanaka

dr.emi.tanaka@gmail.com
@statsgen

Check that you can:

  • Make a html document from .Rmd
  • Make a pdf document from .Rmd
  • Have some understanding of how R Markdown works under the hood.
  • Have some understanding of how some R Markdown components works only in specific output formats.
16/16

Hi! I'm Emi! 👋


I'm a lecturer in statistics at The University of Sydney (soon moving to Monash University).


Introduce yourself to someone you don't know!

03:00
2/16
Paused

Help

Keyboard shortcuts

, , Pg Up, k Go to previous slide
, , Pg Dn, Space, j Go to next slide
Home Go to first slide
End Go to last slide
Number + Return Go to specific slide
b / m / f Toggle blackout / mirrored / fullscreen mode
c Clone slideshow
p Toggle presenter mode
t Restart the presentation timer
?, h Toggle this help
Esc Back to slideshow