background-image: url(images/bg2.jpg) background-size: cover class: hide-slide-number :::::::::: { .grid grid: 50% 50% / 1fr;} ::: item center # <span style="text-shadow: 2px 2px 30px white;">Communicating with Data <br> via R Markdown</span> <br><br> ## <span style="color:white;text-shadow: 2px 2px 30px black;">R Markdown Basics</span> ::: ::: item center shade_black animated bounceInUp slower Presented by Emi Tanaka School of Mathematics and Statistics <img src="assets/USydLogo-white.svg" style="width:200px"><br>
<i class="fas fa-envelope faa-float animated "></i>
dr.emi.tanaka@gmail.com
<i class="fab fa-twitter faa-float animated faa-fast "></i>
@statsgen 4th October 2019 | COMBINE | Sydney, Australia ::: :::::::::: ::: { .shade_black .pos .font_small width:20%;right:10px;bottom:20%;padding:5px;border: solid 5px white;} <i class="fas fa-exclamation-circle"></i> These slides are viewed best by Chrome and occasionally need to be refreshed if elements did not load properly. See here for <a href=session1.pdf style="color:white!important"/>PDF <i class="fas fa-file-pdf"></i></a>. ::: --- class: question ::: {.item text-align:left; } **Hi! I'm Emi! 👋** <br> I'm a .yellow[lecturer in statistics] at The University of Sydney (soon moving to .yellow[Monash University]). <br> **Introduce yourself to someone you don't know!** :::
03
:
00
--- class: question # HELP! <img src="images/sticky-note.png" width="150px"/> Please send SOS signal by attaching sticky note on your laptop. <br> Please help your neighbours 🙏 --- class: challenge font_smaller middle Open <br> http://bit.ly/rmd-combine-2019 <br> and save a permanent copy to your RStudio Cloud account. --- class: center # Schedule <br> | 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 | --- # R Markdown Basics <img src="images/demo-first-rmd.png" width="70%" /> --- # Knitting: <code>Rmd</code> <i class="far fa-file"></i> <i class="fas fa-arrow-right"></i> <code>md</code> <i class="far fa-file"></i> <i class="fas fa-arrow-right"></i> <code>html</code> <i class="far fa-file"></i> <img src="images/demo-knit-html.png" width="100%" /> --- # Knitting: <code>Rmd</code> <i class="far fa-file"></i> <i class="fas fa-arrow-right"></i> <code>md</code> <i class="far fa-file"></i> <i class="fas fa-arrow-right"></i> <code>pdf</code> <i class="far fa-file"></i> <img src="images/demo-knit-pdf.png" width="100%" /> --- class: middle question There are many other .yellow[output formats] possible with R Markdown via Pandoc. Can you name another 3? --- class: font_small # R Markdown under the hood: `html_document` .indigo[`knitr`] 📦 does the hard work of converting <code>Rmd</code> <i class="far fa-file"></i> <i class="fas fa-arrow-right"></i> <code>md</code> <i class="far fa-file"></i> ::: grid ::: item ````markdown --- title: "My Report" output: html_document --- # Hello ```{r} 1 + 1 ``` ```` <p></p> ::: ::: item ````markdown --- title: "My Report" output: html_document --- # Hello ```r 1 + 1 ``` ``` ## [1] 2 ``` ```` <p></p> ::: ::: ::: {.pos top:20%;left:20%;} `Rmd` <i class="far fa-file"></i> ::: ::: {.pos top:20%;left:70%;} `md` <i class="far fa-file"></i> ::: --- class: font_small # R Markdown under the hood: `html_document` Then .indigo[`rmarkdown`] 📦 prepares <code>md</code> <i class="far fa-file"></i> for .indigo[`pandoc`] to convert to html <i class="far fa-file"></i>. ::: grid ::: item ````markdown --- title: "My Report" output: html_document --- # Hello ```r 1 + 1 ``` ``` ## [1] 2 ``` ```` <p></p> ::: ::: item ```html <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> ``` ::: ::: ::: {.white .font_small .pos bottom:60px; right:10%; width:200px;padding:5px;background-color:rgb(256,160,160, 0.3);border: solid 3px black; } <i class="fas fa-exclamation-triangle"></i> This html file is missing some elements due to restriction of space. ::: ::: {.pos top:20%;left:20%;} `md` <i class="far fa-file"></i> ::: ::: {.pos top:20%;left:70%;} `html` <i class="far fa-file"></i> ::: --- class: font_small # R Markdown under the hood: .red[`pdf_document`] Same as before: `knitr` 📦 converts <code>Rmd</code> <i class="far fa-file"></i> <i class="fas fa-arrow-right"></i> <code>md</code> <i class="far fa-file"></i> ::: grid ::: item ````markdown --- title: "My Report" output: pdf_document --- # Hello ```{r} 1 + 1 ``` ```` <p></p> ::: ::: item ````markdown --- title: "My Report" output: pdf_document --- # Hello ```r 1 + 1 ``` ``` ## [1] 2 ``` ```` <p></p> ::: ::: ::: { .pos top:20%;left:20%; } `Rmd` <i class="far fa-file"></i> ::: ::: { .pos top:20%;left:70%; } `md` <i class="far fa-file"></i> ::: --- class: font_small # R Markdown under the hood: .red[`pdf_document`] Then `rmarkdown` 📦 prepares <code>md</code> <i class="far fa-file"></i> for `pandoc` to convert to .indigo[`tex`] <i class="far fa-file"></i> <i class="fas fa-arrow-right"></i> pdf <i class="fas fa-file-pdf"></i>. ::: grid ::: item ````markdown --- title: "My Report" output: html_document --- # Hello ```r 1 + 1 ``` ``` ## [1] 2 ``` ```` <p></p> ::: ::: item ```latex \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} ``` ::: ::: ::: {.pos top:20%;left:10%;} `md` <i class="far fa-file"></i> ::: ::: {.pos top:20%;left:40%;} `tex` <i class="far fa-file"></i> ::: ::: {.white .font_small .pos bottom:7%; right:10%; width:200px;padding:5px;background-color:rgb(256,160,160, 0.3);border: solid 3px black; } <i class="fas fa-exclamation-triangle"></i> This tex document is missing elements before `\begin{document}` due to restriction of space. ::: --- class: challenge middle #Get started with `challenge-01.Rmd`
05
:
00
--- class: challenge middle # Advanced question How do you render different output formats at once? --- background-image: url(images/bg2.jpg) background-size: cover class: hide-slide-number ::: grid ::: {.item .shade_black .animated .slideInLeft border-right-style:solid; border-right-color:white; } # That's it! These slides are made using `xaringan` R-package. The workshop materials are licensed under [<img src="images/cc.svg" style="height:1em"/><img src="images/by.svg" style="height:1em"/><img src="images/sa.svg" style="height:1em"/>](https://creativecommons.org/licenses/by-sa/3.0/au/). <br><br> Emi Tanaka <i class="fas fa-envelope faa-float animated"></i> dr.emi.tanaka@gmail.com<br> <i class="fab fa-twitter faa-float animated faa-fast"></i> @statsgen ::: ::: {.item .shade_black .checklist .animated .slideInRight border-left-style: solid; border-right-color: white;} # Check that you can: <ul> <li>Make a html document from .Rmd</li><li>Make a pdf document from .Rmd</li><li>Have some understanding of how R Markdown works under the hood.</li><li>Have some understanding of how some R Markdown components works only in specific output formats.</li> </ul> ::: :::