This is a very quick introduction to R Markdown. For more details, see http://rmarkdown.rstudio.com/index.html.

Click “run chunk” to run a single chunk of code. Click “Knit” to create an html (or other format) document. By default, R studio with R Markdown installed shows results in notebook style. To turn this off, click the gear icon in the document toolbar and select “Chunk output in console.”

When turning in assignments, each problem should be identified using a level 1 header (Level 1 headers can be made by preceding text with #). Please submit HW in html format using polylearn.

0.1

Here is my solution to problem 0.1

0.1 (a)

If a problem has sub parts, please identify like this.

0.1 (b)

Solution to part (b).

0.2

Here is some text followed by some R code.

x=ts(rnorm(100))
y=filter(x,rep(1/5,5))
summary(x)
##     Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
## -2.32500 -0.84160 -0.09632 -0.12520  0.59450  2.23400

The following options can be used to modifu the display of code and results:

See the R Markdown Reference Guide for a complete list of knitr chunk options.

Example of include=false:

Example of echo=false:

##     Min.  1st Qu.   Median     Mean  3rd Qu.     Max. 
## -2.35100 -0.70000  0.06647 -0.06773  0.65090  2.93900

Inline code

You can include inline code like this: -2.351, -0.7, 0.06647, -0.06773, 0.6509, 2.939..

0.2

Here is how to make sub-bullets:

End of bullet list

0.3

Here is how to make an enumeration list:

  1. one
  2. two
  3. five (notice that the number itself is ignored…)
  4. Just start every item with number 1 for simpolicity…
    1. Here is a sub-item on two lines
    2. And another one

0.4

Here is a definition list (note that 2 spaces or a tab are required before the description text)

Item 1
description of item 1
Item 2
description of item 2.

0.5

This is such a complicated problem… Hopefully this figure will really clear things up.

ts.plot(cbind(x,y), main="Sample plot", col=c(1:2))

0.6

Markdown provides a simple way of formatting text. Here is emphasized text or like this. Or bold or like this.

Math can be formatted using tex, like this \(x=y\).for inline math. Here are a few examples of displayed equations \[ x = \int y\, dy \]

\[ \alpha = \beta \times \gamma + \frac{z^2 - 3y}{3\sqrt{zy}} \]

\[ z = \sum_{i=1}^\infty x_i \]

Look up a tex reference like https://en.wikibooks.org/wiki/LaTeX for more details.