#R - Rmd Post Template

A sentence to be used as news excerpt. This should be short enough to fit nicely the carousel on the home page.

R Markdown

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

Also refer to the conventional markdown news post template for general instructions and guidelines about writing news posts, including details about including non-R-generated pictures, links, etc.

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)  {
  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

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) plot of chunk pressure


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:

## [1] "DUMMY"