# #R - Rmd Post Template

A sentence to be used as news excerpt.

#### R Markdown

Refer to the R Studio website for a comprehensive introduction to R Markdown.

Latex-like math is supported as inline $S = \sum_{n=1}^{\infty} \frac{1}{2^{n}}$ or displayed equations (you must leave an empty line above and below)

##### Code chunks

This is an example of R chunk called my-first-chunk (it is recommended to name all chunks), without any special option.

# some code
(a <- 10)
## [1] 10
b <- sqrt(a)
a + b
## [1] 13.16228


You can fine-tune the behavior/results using chunk options, e.g. echo=FALSE, eval=FALSE, include=FALSE, results='hide'.

Get used to write consistently-formatted, tidy R code, especially concerning spacing and parentheses (see e.g. the ‘Syntax’ section in Hadley’s style guide).

The following is an example of un-tidy, poorly formatted code:

fun <-function(x  =NULL)
{
if(length(x)!=0)  {
x<-0.0;
}
return( x )
}
fun  (0.0)
## [1] 0


Besides writing tidy code yourself, you might want to use the \code{tidy} chunk option, causing the R code to be re-formatted in a tidy way. (This can be enabled for all code chunks in the initial setup chunk.)

fun <- function(x = NULL) {
if (length(x) != 0) {
x <- 0
}
return(x)
}
fun(0)


Note that previous chunks can be re-called by name later in the document, as in the tidy chunk above.

Figures generated by plotting in any R code chunk are automatically generated and linked (note echo=FALSE to show only the image and not the underlying code)

#### Parameters

Parameters declared in the params field within the YAML header are accessible as read-only list called params.

The list can be used inline (DUMMY) or in R code chunks:

params\$dummy
## [1] "DUMMY"


#### Conventional markdown

As in any markdown document (like the manually-created .md posts), you can use headers to define titled sections and sub-sections. Only level 4 #### and 5 ##### are recommended for proper rendering on the website.

New paragraph to assess spacing. New paragraph to assess spacing. New paragraph to assess spacing. New paragraph to assess spacing.

Links to external websites or within the website, including pictures, should be specified as in the manually-created .md posts.

##### Pictures

This is a picture with a paragraph of text above… …and below, continuing to assess spacing, continuing to assess spacing.

New paragraph to assess spacing. New paragraph to assess spacing. New paragraph to assess spacing. New paragraph to assess spacing.

Links to a website section open in the same tab, whereas links to a file hosted on the website would open in a new tab.

This is e.g. a link to CRAN, opened in a new tab.