class: center, middle, inverse, title-slide # POL 478H1 F ## R, Rstudio, and RMarkdown ### Olga Chyzh [www.olgachyzh.com] --- ## Software to Download - [R](https://www.r-project.org/) - [RStudio](https://rstudio.com/products/rstudio/download/) --- ## The RStudio IDE <img src="Rstudio.png" width="1400px" style="display: block; margin: auto;" /> --- ## Markdown - Markdown is a **markup** language. - Markup languages help **produce documents** (e.g., web pages, pdfs) from plain text. - Other markup languages include **LaTeX**, **HTML**, and **xml**. - Markdown has become **widespread**. Many websites will generate HTML from Markdown (e.g. GitHub, Stack Overflow, reddit, ...). --- ## Basic Markdown ```r *italic* **bold** #Header 1 ## Header 2 ### Header 3 - List item 1 - List item 2 - item 2a - item 2b 1. Numbered list item 1 2. Numbered list item 2 ``` Check out RStudio's [RMarkdown cheat sheet](https://rstudio.com/wp-content/uploads/2015/02/rmarkdown-cheatsheet.pdf) --- ## What is RMarkdown - R Markdown is a file format for making dynamic documents with R. - An R Markdown document is written in Markdown and contains chunks of embedded R code. - Allows for regenerating the document whenever the code/data/text changes. - Also supports `HTML` and `LaTeX`. --- <img src="Rmarkdown.png" width="2200px" style="display: block; margin: auto;" /> --- <img src="first_Rmd.png" width="2200px" style="display: block; margin: auto;" /> --- ## Your Turn 1. Open RStudio and create a new Rmarkdown document. Save it with name `myfirstmarkdown.Rmd` 2. Knit it. 3. Go to your folder and open `myfirstmarkdown.html` file. 4. Go back to Rstudio and edit the first Markdown chunk to say: With RMarkdown, you can... 1. Make ordered lists 2. *Type text in italics* 3. **or in bold** 4. `or verbatim` 5. And you can even ~~do this~~ 6. Here is how you make a subscript <sub>2</sub> and a superscript <sup>2</sup> Hint: Use RStudio's [RMarkdown cheat sheet](https://rstudio.com/wp-content/uploads/2015/02/rmarkdown-cheatsheet.pdf) to figure out how to complete items 2--6.