1 This is a Heading 1

1.1 This is a Heading 2

1.1.1 This is a Heading 3

2 Lists

2.1 Not enumerated

  • An item
    • A nested item with boldface
      • A doubly-nested item with italics
  • Another item with some text stricken out
  • URL: Penn State Home

2.2 Enumerated

  1. An enumerated item
    • A nested item
  2. A second enumerated item
    1. A nested item with a footnote 1 marker. Look for the text at the end of the document.
    2. A second nested item. See how alphabetical enumerated lists work like you’d expect.

2.3 Block quotation

Four score and seven years ago, some famous President spoke infamous words that would live on throughout history. These words are famous enough that I want to highlight them with a block quote.

3 Make some data

x = rnorm(n = 100, mean = 0, sd = 1)   # N(0,1)
y = rnorm(n = 100, mean = 2, sd = 0.5) # N(2, 0.5)

3.1 Summarize

summary(x)
##     Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
## -2.21193 -0.53439 -0.03109  0.05531  0.62095  2.84033
summary(y)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##  0.7084  1.6985  2.0376  2.0367  2.3766  3.3162

3.2 Histogram

hist(x)

3.3 Plot

plot(x,y)

4 Embed figures or videos

Some of these methods work better than others with a particular output format.

4.1 From the web using knitr::include_graphics().

The html_document format is fine with using the URL as the input to knitr::include_graphics(), but the pdf_document format seems to want a local file path, hence the use of download.file().

download.file("https://nyu.databrary.org/party/6/avatar",'img/rog.png', mode = 'wb')
knitr::include_graphics("img/rog.png")
Rick's pic from Databrary

Rick’s pic from Databrary

4.2 From a local file using HTML

4.3 From a local file using knitr::include_graphics()

knitr::include_graphics("img/sleic.jpg")

4.4 From a local file using Markdown syntax

SLEIC

4.5 From YouTube

5 Printing values from R

summ.x = summary(x)
summ.y = summary(y)
names(summ.x) # Figure out variable names for indexing
## [1] "Min."    "1st Qu." "Median"  "Mean"    "3rd Qu." "Max."

Index by variable name: X lies within the range of [-2.2119335, 2.8403283].

Index by numeric index: The (y-x) difference in means is 1.981394.

Calculate and report: The correlation between x and y is 0.0732853.

6 Math equations

\[e=mc^{2}\]

7 Parameterized reports

7.1 My name is Steve

7.2 My quest is to find the grail

7.3 My favorite color is blue

8 Footnotes


  1. Here is the footnote text. Note that it ends up at the end of the document.↩︎