title:  'This is the title: it contains a colon'
author:
- Author One
- Author Two
tags: [nothing, nothingness]
abstract: |
  This is the abstract.

  It consists of two paragraphs.
  
  

output: html_document
---
# H1 header

H1
====

## A level-two header

H2
----

### A level-three header ###


H1 header

H1

A level-two header

H2

A level-three header

> This is a block quote. This
> paragraph has two lines.
>
> 1. This is a list inside a block quote.
> 2. Second item.

This is a block quote. This paragraph has two lines.

  1. This is a list inside a block quote.
  2. Second item.

A “lazy” form, which requires the > character only on the first line of each block, is also allowed:

> This is a block quote. This
paragraph has two lines.

> 1. This is a list inside a block quote.
2. Second item.

This is a block quote. This paragraph has two lines.

  1. This is a list inside a block quote.
  2. Second item.

Code blocks


    if (a > 3) {
      moveShip(5 * gravity, DOWN);
    }
    
if (a > 3) {
  moveShip(5 * gravity, DOWN);
}
~~~~~~~
if (a > 3) {
  moveShip(5 * gravity, DOWN);
}
~~~~~~~
if (a > 3) {
  moveShip(5 * gravity, DOWN);
}

Basic Usage

R code chunks can be used as a means render R output into documents or to simply display code for illustration. Here is a simple R code chunk that will result in both the code and it’s output being included:

Chunk options

summary(cars)
##      speed           dist       
##  Min.   : 4.0   Min.   :  2.00  
##  1st Qu.:12.0   1st Qu.: 26.00  
##  Median :15.0   Median : 36.00  
##  Mean   :15.4   Mean   : 42.98  
##  3rd Qu.:19.0   3rd Qu.: 56.00  
##  Max.   :25.0   Max.   :120.00

To display the output of a code chunk but not the underlying R code, you specify the echo=FALSE option:

##      speed           dist       
##  Min.   : 4.0   Min.   :  2.00  
##  1st Qu.:12.0   1st Qu.: 26.00  
##  Median :15.0   Median : 36.00  
##  Mean   :15.4   Mean   : 42.98  
##  3rd Qu.:19.0   3rd Qu.: 56.00  
##  Max.   :25.0   Max.   :120.00

Note that R code chunks can also be used to render plots. To display a plot while omitting the code used to generate the plot you’d do this:

To display R code without evaluating it, you specify the eval=FALSE chunk option:

summary(cars)

echo, results, collapse, warning, error, message, split, tidy, prompt ##Rcpp

#include <Rcpp.h>

// [[Rcpp::export]]
int fibonacci(const int x) {
    if (x == 0 || x == 1) return(x);
    return (fibonacci(x - 1)) + fibonacci(x - 2);
}

Because fibonacci was defined with the Rcpp::export attribute it can now be called as a normal R function:

fibonacci(10L)
## [1] 55
fibonacci(20L)
## [1] 6765

Other exmaples

cowsay "I'm eat R for supper. MUHAHAHAHA"
##  __________________________________ 
## < I'm eat R for supper. MUHAHAHAHA >
##  ---------------------------------- 
##         \   ^__^
##          \  (oo)\_______
##             (__)\       )\/\
##                 ||----w |
##                 ||     ||
x = 'hello, python world!'
print(x.split(' '))
## ['hello,', 'python', 'world!']

Data exchange between python and R

import pandas
import feather

# Read flights data and select flights to O'Hare
flights = pandas.read_csv("/home/sobhan/Documents/flights.csv")
flights = flights[flights['dest'] == "ORD"]

# Select carrier and delay columns and drop rows with missing values
flights = flights[['carrier', 'dep_delay', 'arr_delay']]
flights = flights.dropna()
print (flights.head(10))

# Write to feather file for reading from R
feather.write_dataframe(flights, "flights.feather")
##     carrier  dep_delay  arr_delay
## 6        UA      227.0      219.0
## 17       AA        0.0      -19.0
## 20       UA       -3.0        7.0
## 22       UA       -3.0       -2.0
## 51       AA       -4.0      -28.0
## 86       AA      -10.0      -11.0
## 95       AS       -5.0       15.0
## 129      AS       -5.0        2.0
## 134      UA       75.0       81.0
## 156      UA        3.0       -4.0

Now we read the feather file from R and plot the data frame using ggplot2:

library(feather)
library(ggplot2)

# Read from feather and plot
flights <- read_feather("flights.feather")
ggplot(flights, aes(carrier, arr_delay)) + geom_point() + geom_jitter()

Lists

Bullet lists

* fruits
    + apples
        - macintosh
        - red delicious
    + pears
    + peaches
* vegetables
    + broccoli
    + chard
  • fruits
    • apples
      • macintosh
      • red delicious
    • pears
    • peaches
  • vegetables
    • broccoli
    • chard

Numbered lists

Ordered lists work just like bulleted lists, except that the items begin with enumerators rather than bullets.

In standard Markdown, enumerators are decimal numbers followed by a period and a space. The numbers themselves are ignored, so there is no difference between this list:


1.  one
2.  two
3.  three


600.  one
7.  two
1.  three

#. one
#. two

300)  Ninth
10)  Tenth
11)  Eleventh
       i. subone
      ii. subtwo
     iii. subthree
    iiii. subfour
  1. one
  2. two
  3. three

and this one:

  1. one
  2. two
  3. three

  4. one
  5. two

  1. Ninth
  2. Tenth
  3. Eleventh
    1. subone
    2. subtwo
    3. subthree
    4. subfour

Pandoc will start a new list each time a different type of list marker is used. So, the following will create three lists:

(44) Two
(5) Three
1.  Four
*   Five     
  1. Two
  2. Three
  1. Four
  • Five

List end

<!-- -->

Numbered example lists

The special list marker @ can be used for sequentially numbered examples. The first list item with a @ marker will be numbered ‘1’, the next ‘2’, and so on, throughout the document. The numbered examples need not occur in a single list; each new list using @ will take up where the last stopped. So, for example:

(@)  My first example will be numbered (1).
(@)  My second example will be numbered (2).

Explanation of examples.

(@)  My third example will be numbered (3).
  1. My first example will be numbered (1).
  2. My second example will be numbered (2).

Explanation of examples.

  1. My third example will be numbered (3).

Numbered examples can be labeled and referred to elsewhere in the document:

(@good)  This is a good example.

As (@good) illustrates, ...
  1. This is a good example.

As (4) illustrates, …

The label can be any string of alphanumeric characters, underscores, or hyphens.

Inline formatting

Emphasis

To emphasize some text, surround it with *s or _, like this:

This text is emphasized with underscores, and this is emphasized with asterisks.

Double * or _ produces strong emphasis:

This is strong emphasis and with underscores.

A * or _ character surrounded by spaces, or backslash-escaped, will not trigger emphasis:

This is * not emphasized *, and *neither is this*.

This ~~is deleted text.~~

H~2~O is a liquid.  2^10^ is 1024.

This is deleted text.

H2O is a liquid. 210 is 1024.

Verbatim

What is the difference between `>>=` and `>>`?

Here is a literal backtick `` ` ``.

What is the difference between >>= and >>?

Here is a literal backtick `.

Math

Anything between two $ characters will be treated as TeX math. The opening $ must have a non-space character immediately to its right, while the closing $ must have a non-space character immediately to its left, and must not be followed immediately by a digit. Thus, $20,000 and $30,000 won’t parse as math. If for some reason you need to enclose text in literal $ characters, backslash-escape them and they won’t be treated as math delimiters.\(\rho\)

$\rho$

Raw HTML

Markdown allows you to insert raw HTML (or DocBook) anywhere in a document (except verbatim contexts, where <, >, and & are interpreted literally). (Technically this is not an extension, since standard Markdown allows it, but it has been made an extension so that it can be disabled if desired.)

The raw HTML is passed through unchanged in HTML, S5, Slidy, Slideous, DZSlides, EPUB, Markdown, Emacs Org mode, and Textile output, and suppressed in other formats.

Raw TeX

In addition to raw HTML, pandoc allows raw LaTeX, TeX, and ConTeXt to be included in a document. Inline TeX commands will be preserved and passed unchanged to the LaTeX and ConTeXt writers.

Footnotes

Pandoc’s Markdown allows footnotes, using the following syntax:

Here is a footnote reference,[^1] and another.[^longnote]

[^1]: Here is the footnote.

[^longnote]: Here's one with multiple blocks.

    Subsequent paragraphs are indented to show that they
belong to the previous footnote.

        { some.code }

    The whole paragraph can be indented, or just the first
    line.  In this way, multi-paragraph footnotes work like
    multi-paragraph list items.

Here is a footnote reference,1 and another.2

Inline footnotes are also allowed (though, unlike regular notes, they cannot contain multiple paragraphs). The syntax is as follows:

Here is an inline note.^[Inlines notes are easier to write, since
you don't have to pick an identifier and move down to type the
note.]

Here is an inline note.3

Inline and regular footnotes may be mixed freely.

Citations

blah blah [see @WatsonCrick1953]

@WatsonCrick1953 says blah.

@WatsonCrick1953 [p. 33] says blah.

blah blah (see Watson and Crick 1953)

Watson and Crick (1953) says blah.

Watson and Crick (1953, 33) says blah.

---
references:
- type: article-journal
  id: WatsonCrick1953
  author:
  - family: Watson
    given: J. D.
  - family: Crick
    given: F. H. C.
  issued:
    date-parts:
    - - 1953
      - 4
      - 25
  title: 'Molecular structure of nucleic acids: a structure for deoxyribose
    nucleic acid'
  title-short: Molecular structure of nucleic acids
  container-title: Nature
  volume: 171
  issue: 4356
  page: 737-738
  DOI: 10.1038/171737a0
  URL: http://www.nature.com/nature/journal/v171/n4356/abs/171737a0.html
  language: en-GB
---

Horizontal rules

A line containing a row of three or more *, -, or _ characters (optionally separated by spaces) produces a horizontal rule:

*  *  *  *

---------------


table

  Right     Left     Center     Default
-------     ------ ----------   -------
     12     12        12            12
    123     123       123          123
      1     1          1             1
Right Left Center Default
12 12 12 12
123 123 123 123
1 1 1 1
Centered Header Default Aligned Right Aligned Left Aligned
First row 12.0 Example of a row that spans multiple lines.
Second row 5.0 Here’s another one. Note the blank line between rows.
Here’s a multiline table without headers.
First row 12.0 Example of a row that spans multiple lines.
Second row 5.0 Here’s another one. Note the blank line between rows.
Sample grid table.
Fruit Price Advantages

Bananas

$1.34

  • built-in wrapper
  • bright color

Oranges

$2.10

  • cures scurvy
  • tasty
Demonstration of pipe table syntax.
Right Left Default Center
12 12 12 12
123 123 123 123
1 1 1 1

Using knit

kable xtable stargazer


  1. Here is the footnote.

  2. Here’s one with multiple blocks.

    Subsequent paragraphs are indented to show that they belong to the previous footnote.

    { some.code }

    The whole paragraph can be indented, or just the first line. In this way, multi-paragraph footnotes work like multi-paragraph list items.

  3. Inlines notes are easier to write, since you don’t have to pick an identifier and move down to type the note.