Introduction

This report demonstrates R Markdown’s capabilities.

Hint: Remember that you need to replicate this report EXACTLY, except you should not replicate the Hints and you should use your name and the correct date in your YAML header.

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

Hint: You can find the syntax to do everything here 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: 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 (apples).

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

Embed an external image with a url. For example, we can use this url to embed the butterfly photograph below.