class: center, middle, inverse, title-slide # Quick Demos of the R Markdown Ecosystem ###
Yihui Xie
, RStudio ### 2019/06/17 @ the RaukR Summer School (Visby, Sweden) --- class: center ### Free online: https://bookdown.org/yihui/rmarkdown/  ??? Reading the "R Markdown" book in 50 minutes. Why quick demos? I love cooking, and I'll be more confident if I have seen someone else cook a dish. --- # Four ways of compiling an Rmd file - Section 2.2: https://bookdown.org/yihui/rmarkdown/compile.html - I want to demo `xaringan::inf_mr()` here. Features include: - Compiles the document in the current R session (this could be good or bad). - Automatically regenerates and refreshes the output page when saving the Rmd source file. - Remembers the scroll position of the HTML page. - For **xaringan** slides only: live-preview slides. --- # Working with other languages - Section 2.7: https://bookdown.org/yihui/rmarkdown/language-engines.html - Bash/Shell scripts - Python - SQL, C++, Stan, JavaScript, CSS, Julia, C, Fortran, ... --- # HTML document - The output format: `html_document` - Section 3.1: https://bookdown.org/yihui/rmarkdown/html-document.html - Tabbed sections ```md ## Quarterly Results {.tabset} ### By Product (tab content) ### By Region (tab content) ``` - Code folding --- # HTML notebook - The output format: `html_notebook` - Section 3.2: https://bookdown.org/yihui/rmarkdown/notebook.html - You can execute code chunks inside the Rmd source document - The `*.nb.html` file is similar to `*.ipynb` but based on HTML instead of JSON --- # PDF document - Section 3.3: https://bookdown.org/yihui/rmarkdown/pdf-document.html - The `extra_dependencies` option, e.g., ```md output: pdf_document: extra_dependencies: [longtable, framed] ``` Then these LaTeX packages will be used in the preamble of the LaTeX file generated from Rmd: ```tex \usepackage{longtable} \usepackage{framed} ``` See `?rmarkdown::pdf_document` for advanced usage of this option, e.g., ```md extra_dependencies: hypreref: ["unicode=true", "breaklinks=true"] lmodern: null ``` --- # Word document - `word_document` - Section 3.4: https://bookdown.org/yihui/rmarkdown/word-document.html - Use the `reference_docx` option to customize the style: https://vimeo.com/110804387 --- # ioslides - `ioslides_presentation` - Section 4.1: https://bookdown.org/yihui/rmarkdown/ioslides-presentation.html - Background attributes --- # Beamer presentation - `beamer_presentation` - Section 4.3: https://bookdown.org/yihui/rmarkdown/beamer-presentation.html - Change beamer themes from the RStudio editor --- # PowerPoint presentation - Section 4.4: https://bookdown.org/yihui/rmarkdown/powerpoint-presentation.html - You can also customize the theme/style of PPT like Word (use the `reference_doc` option) --- # Dashboard - Output format: `flexdashboard::flex_dashboard` - Chapter 5: https://bookdown.org/yihui/rmarkdown/dashboards.html - The overall rule about the dashboard layout is that - a first-level section `#` generates a **page** - a second-level section `##` generates a **column** (or a **row**) - a third-level section `###` generates a **box** (that contains one or more dashboard components). - Components, e.g.,  --- # Tufte handouts - Chapter 6: https://bookdown.org/yihui/rmarkdown/tufte-handouts.html - The **tufte** package: https://github.com/rstudio/tufte .center[] --- # xaringan presentation - Chapter 7: https://bookdown.org/yihui/rmarkdown/xaringan.html - The **xaringan** package: https://github.com/yihui/xaringan - Output format: `xaringan::moon_reader` - Probably the most famous feature: `yolo = TRUE` - Keyboard shortcuts ??? Here are some notes that I can see on my own screen but not presented to the audience. --- # Website - The **blogdown** package: https://github.com/rstudio/blogdown - Create a website from the RStudio project wizard - RStudio addins (Serve Site, New Post, ...) --- # Book - The **bookdown** package: https://github.com/rstudio/bookdown - Create a book from the RStudio project wizard - HTML (e.g., `gitbook`), PDF, Word, EPUB output - Single documents (not necessarily a book) --- # Journal article - The **rticles** package: https://github.com/rstudio/rticles - Create a new article from an R Markdown template in RStudio --- # Interactive tutorial - The **learnr** package: https://github.com/rstudio/learnr - Create a tutorial from the R Markdown template in RStudio --- # Thanks! - Slides: [bit.ly/2019-raukr](https://bit.ly/2018-raukr) - Me: https://yihui.org - Questions? Consider [Stack Overflow](https://yihui.org/en/2017/08/so-gh-email/), or RStudio Community (https://community.rstudio.com).