---
title: "R_Markdown-Instructions"
author: "Michael Kummer"
output: pdf_document
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```


# R markdown

You may have noted that your lab notes are pdf files in which text, R code, and R output are all nicely integrated. This is possible due to R markdown. R markdown allows you to create pdf or html files directly from R studio. R markdown files work in a similar way to R scripts with the exception that they assume everything is text unless you specify otherwise. In order to open an R markdown file click on the white square with the green plus sign, select the option "R markdown", accept the default option (html) and click OK. This will open a R markdown template. 

You can replace the default template by the following:

title: "Homework 2"

author: "Student name 1, Student name 2, Student name 3"

output: html_document

You can use R markdown to submit your BRM homework assignments (this is **optional**).

In order to write code in an R markdown file, you need to start a code chunk by typing the back quote (grave accent) three times followed by the letter "r" inside curly brackets. To close the code chunk just type the back quote three times again. This is exemplified in the default R markdown file. Code chunks are highlighted in grey.

In the first code chunk of your R markdown file you should set your working directory and then activate the necessary packages:

```{r}
setwd("C:/TopicsDig/Labs")
# change the file's path to your own
library(data.table)
```

You should create additional code chunks as needed in order to answer your homework questions.

You can introduce a title with the hashtag symbol - one hashtag creates a main title, two hashtags creates a subtitle, and three hashtags too. 

You can change text to boldface by using two asterisks at the beginning and end of the word or phrase. One asterisk changes text to italics. 

## R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.

When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

```{r cars}
summary(cars)
```

## Including Plots

You can also embed plots, for example:

```{r pressure, echo=FALSE}
plot(pressure)
```

Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.


## Aditional Resources

http://cran.r-project.org/doc/contrib/Short-refcard.pdf

http://rmarkdown.rstudio.com/


# Acknowledgements and Thanks:
This lab is based on material by M Godinho de Matos, R Belo and F Reis. Gratefully acknowledged! 

