class: title-slide <br><br><br> # .font200[Data Science with Unix and R] ## .font180[Rmarkdown for Reproducible Research] <br> .marco[ Marco Chiapello <br> January, 14th 2022 ] --- layout: true # Markdown --- ## What is markdown? - Markdown is a lightweight markup language for creating formatted text using a plain-text editor - You can use special characters to define text styles - `#` is used for header definition - `**` around a word makes it **bold** - Refer to this [link](https://www.markdownguide.org/cheat-sheet/) for more detailed information - See the Markdown language in action: [click here](https://markdown-it.github.io/) --- layout: true # Rmarkdown --- <img src="images/rmarkdown_wizards.png" width="5303" height="630px" style="display: block; margin: auto;" /> --- ## What can do Rmarkdown? - R Markdown documents are fully reproducible - Weave together narrative **text** and **code** to produce **elegantly formatted output** - R Markdown supports dozens of **static and dynamic output formats** including HTML, PDF, MS Word, Beamer, HTML5 slides, Tufte-style handouts, books, dashboards, shiny applications, scientific articles, websites, and more. --- ## Rmarkdown anatomy There are 3 fundamental elements in a Rmarkdown document 1. Metadata 1. Text 1. R chunks --- ## Metadata The YAML metadata of your document. This is the first part of the document and defines metadata like title and author, but also important iformation for the file output. .panelset[ .panel[.panel-name[Code] ``` --- title: "Untitled" author: "Marco Chiapello" date: "29/12/2021" output: html_document --- ``` ] .panel[.panel-name[Output] <img src="images/rmarkdown-metadata1.png" width="830px" height="430px" style="display: block; margin: auto;" /> ] ] --- ## Plain text The text in a Rmarkdown document is a regular text using the markdown sysntax .panelset[ .panel[.panel-name[Code] ``` --- title: "Untitled" author: "Marco Chiapello" date: "29/12/2021" output: html_document --- # Introduction Goodmorning to **everybody** and welcome to this *amazing* ~~COURSE~~ MODULE of the PhDToolbox course ``` ] .panel[.panel-name[Output] <img src="images/rmarkdown-text1.png" width="830px" height="430px" style="display: block; margin: auto;" /> ] ] --- ## R chunk The R chunk is the place where we can write down R code and make it interact with the document. .panelset[ .panel[.panel-name[Code] <img src="images/rmarkdown-chunk1.png" width="830px" height="300px" style="display: block; margin: auto;" /> ] .panel[.panel-name[Output] <img src="images/rmarkdown-chunk2.png" width="830px" height="330px" style="display: block; margin: auto;" /> ] ] --- layout: false class: inverse, middle, center .white[ .font700[DEMO] ]