Introduction

This report demonstrates R Markdown’s capabilities.

Hint: You need to replicate this report EXACTLY, except you should ignore Hints and replace the name and date in the YAML header.

Hint: There are 3 section header sizes used in this report. The Introduction is the largest header size.

Hint: Automatically generate a table of contents by specifying the following output settings in your YAML header:

output:
  html_document:
    toc: true
    toc_depth: 3

Hint: You can find the syntax to do everything in the R Markdown reference guide that I mentioned in the Assignment!

1 Formatting text

This section demonstrates text formatting.

1.1 Basic in-line text formatting

R Markdown uses the knitr R package under the hood. You can knit documents by pressing the Knit button in R Studio. Amazing!

Hint: Be sure the hyperlink you create actually works! The link above should send you to the home page for R Markdown.

Hint: The word ‘knitr’ above is formatted as in-line code. It doesn’t get run like a real code block. It is just a special way to highlight text.

1.2 Lists

Lists are a useful way to summarize important information.

You can create numbered lists:

  1. Monday
  2. Tuesday
  3. Wednesday
  4. Thursday
  5. Friday
  6. Saturday
  7. Sunday

Or you can create bullet points:

  • Banana
  • Apple
    • Green apple
    • Red apple
  • Pear

Hint: There must be a single space between your number/bullet and the text. For example, * Banana will work, but *Banana will not.

Hint: Indent four spaces to produce the second-level bullet points (Green apple and Red apple).

1.3 Block quotes

This is a good quote:

All models are wrong, but some are useful. - George Box

2 Formatting code

2.1 Run visible code with output

# Say hello
print('Hello World!')
## [1] "Hello World!"
# A sum of two and two
x <- 2 + 2
x
## [1] 4
# A sequence from 1 to 10
1:10
##  [1]  1  2  3  4  5  6  7  8  9 10

Hint: You can write all of the code in a single block and the multiple outputs automatically get split up.

2.2 Display code WITHOUT running it

# Say hello
print('Hello World!')

# A sum of two and two
x <- 2 + 2
x

# A sequence from 1 to 10
1:10

Hint: You need eval=FALSE in your code block settings.

2.3 Run hidden code and display output only

## [1] "Hello World!"
## [1] 4
##  [1]  1  2  3  4  5  6  7  8  9 10

Hint: You need echo=FALSE in your code block settings.

2.4 Run code and display a plot

# Simulate random data 
set.seed(1)
data <- rnorm(100)

# Plot data
hist(data, main='My Histogram', col='hotpink')

3 Embed an image

The mosquito photograph below can be found at URL https://i.imgur.com/ed1sT04.jpg.

Hint: I like to upload images to imgur and use the resulting URL to embed them in my R Markdown documents.

Hint: You can also use HTML tags in R Markdown documents. For example, to center the image above, you could wrap the embedded image in HTML tags: <center>![](https://link.to.image)</center>.