class: center, middle, inverse, title-slide .title[ # DS 202 - RMarkdown ] .author[ ### ] --- ## Markdown - Markdown is a particular type of **markup** language. - Markup languages are designed to **produce documents from plain text**. - Some of you may be familiar with **LaTeX**. This is another (less human friendly) markup language for creating pdf documents. - LaTeX gives you much greater control, but it is restricted to pdf and has a much greater learning curve. - **Markdown** is becoming a **standard**. Many websites will generate HTML from Markdown (e.g. GitHub, Stack Overflow, reddit, ...). --- ## Markdown is easy ```r *italic* **bold** # Header 1 ## Header 2 ### Header 3 - List item 1 - List item 2 - item 2a - item 2b 1. Numbered list item 1 1. Numbered list item 2 - item 2a - item 2b ``` Have a look at RStudio's [RMarkdown cheat sheet](https://www.rstudio.com/resources/cheatsheets/) ... and even nicer: there is a Visual Editor in RStudio! --- ## What is RMarkdown? - ... an authoring format that enables easy creation of dynamic documents, presentations, and reports from R. - it combines the core syntax of markdown with embedded R code chunks that are run so their output can be included in the final document. - R Markdown documents are fully reproducible (they are automatically regenerated whenever underlying R code or data changes). --- class: inverse ## <img class="cover" src="images/rmarkdown.png" alt=""> --- class: inverse ## Your Turn (10 min) 1. Open RStudio, create a new project - how about `ds202`?. 2. Create a new RMarkdown file (File > New File > R Markdown ...) and knit it. 3. Use the Visual editor to: - claim the document by making yourself the author, - change some of the text to *italic*, - include an enumerated list with three items 4. Switch to the source editor and look at the changes. 5. In a browser, navigate to the RMarkdown cheat sheet and download a copy (Google for the link!) 4. Export output to a different file format (try a word document). If you have Latex installed on your machine you can also try to export to a pdf file. --- class: inverse ## Your Turn (5 min) 1. Make the scatterplot a square (i.e. figure height and figure width should be the same) 2. Hide the code that makes the summary, but show the code for the scatterplot 3. tricky: Include a caption for the scatterplot (you might have to google for this)