This is a small or minimal R Markdown template for our course.
A more extensive introduction is available here
(and the corresponding .Rmd source here).

Load packages

# Install required packages (always):
# install.packages("tidyverse", "ds4psy")

# Load required packages (always):
library(tidyverse)
library(ds4psy)

Text vs. Code

Write your text here.

Put your R code in chunks:

# A unique chunk_name helps to keep track of your various chunks later. 
# R will evaluate the code in this chunk and print the result:
v <- 1:4
sum(v)
## [1] 10

Knitting

To convert an .Rmd source file into .html or .pdf output you need to “knit” it (Command + Shift + K).

If your R code contains errors, the document will fail to knit (and print an error message that specifies the reason or chunk name with problems). Thus, if your document fails to knit, you need to go through your code (in a chunk-by-chunk fashion) to find and fix the error.

See http://rmarkdown.rstudio.com for further information.