--- title: "Examples using (R)Markdown" author: "JJB + Course" date: "06/12/2018" output: html_document --- ```{r setup, include=FALSE} knitr::opts_chunk\$set(echo = TRUE) ``` Hello STAT 385 Summer Students! # Once upon a time, in a galaxy far far away ## There was a class called STAT 385... ### Where statisticians and economists learned about _R_ Within the STAT 385 course, the topics of reproducibility will be emphasized. Welcome to a new paragraph. _What are you planning to do this weekend?_ - **Study** for the GRE - Celebrate Father's Day Weekend!! - Remember to call Dad. - Ship Father's Day card home. - Jumping out of an Airplane. _What's your favorite food?_ 1. Peanut Butter 1. Fried Chicken 1. Pepper ```{r first-code-chunk} # Here is a quick calculation of # the amount of time spent in STAT 385 # for the summer. number_of_course_per_week = 3 hours_per_course = 2 number_of_weeks = 8 time_spent_in_385 = number_of_course_per_week * hours_per_course * number_of_weeks time_spent_in_385 4/time_spent_in_385 ``` ```{r} 1 + 1 ``` ```{r example-code-chunk, eval=FALSE, fig.height=6, fig.width=5, message=FALSE, warning=FALSE, paged.print=FALSE} 43 * 20 / 5 ``` We suppressed the previous code chunk from running. Now, we're going to hide the next code chunk. ```{r suppressed-code, echo = FALSE} 43 * 20 / 5 ``` ------- # From Lecture Slides Writing text with emphasis in *italics*, **bold** and `code style`. Line breaks create a new paragraph. Links can be hidden e.g. [illinois](www.illinois.edu) or not . - Write Selection Simulation - Conference Abstracts - UseR - Learning at Scale 1. Apples 1. Bananas 1. Chobani 1. Pineapple 1. Everything else > "Never gonna give you up, > never gonna let you down..." > > --- Rick Astley Inline math \$a^2 + b^2 = c^2\$ Display math (centered math) \$\$1 - x = y\$\$ Creating a Table | Left | Center | Right | |------------------------------|:------------------------:|----------:| | Hey, check it out | Colons provide | 873 | | its **Markdown** | alignment thus | 1000 | | right in the table | *centered* text | | ```{r, echo = FALSE, cache = TRUE} # This code chunk creates the img directory and downloads the block-i.png to it. dir.create("img") download.file("https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/Illinois_Block_I.png/414px-Illinois_Block_I.png", "img/block-i.png") ``` ![Relative Path](img/block-i.png) Let's hide the _R_ code from showing up in the report! ```{r ex-hide, echo = FALSE} x = 1:10 y = 11:20 plot(x, y) ``` It's ideal to compute values inside of a code chunk and then reference variables from _R_ inline. ```{r calc-values, echo = FALSE} # x = 1:10 x_mu = mean(x) x_sd = sd(x) ``` The _mean_ of **x** is `r x_mu` and the _standard deviation_ is `r x_sd` . We can also supply a pure expression: `r 2 + 3`.