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.

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'.

Note that the initial setup chunk specifies the R code to be re-formatted in a tidy way. Still, get used to write consistently-formatted, R code (see e.g. the ‘Syntax’ section in Hadley’s style guide).

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

Chunks can be re-called by name later in the document, e.g. to show the original un-tidy code above and no results.

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

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

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… View …and below

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

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

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