---
title: "Biol 501 Assignment 1"
<!--  output: html_document -->
output:
  html_document:
    toc: yes
    toc_depth: 3
    toc_float:
      collapsed: no
---

```{r setup, include=FALSE}

# Here's where I can set options that will apply to all code chunks in the document

knitr::opts_chunk$set(echo=TRUE, fig.width=5.5, fig.height=4.5)
```

Blah blah blah. Write in this space, if you need, or just leave this gap between the code chunk and your first header blank.

## Introduction

Blah blah blah. Write in this space below your header. For example, make your introductory points here.

### Include subheadings

Blah

#### And sub-subheadings

Blah

***

## Step 1

Blah blah blah. 

Write in this space. For example, write a few lines about your analysis before you include your first code chunk with your R code. Be **bold** or be *emphatic*. 

The following is a code chunk containing your R code. This chunk will both be shown in your output file. So will the output from executing this code, so make sure you've tested that it works! In the code chunk header you can specify options for how the output of the code chunk will print. For example, I set "message=FALSE" to suppress annoying messages. You can also set "warning=FALSE" to silence warning messages, but be careful with this one because sometimes the warnings must be heeded. "tidy=TRUE" will wrap the code when it prints (but not the comments). 

```{r eval = TRUE, message=FALSE, warning=FALSE, fig.width=6, fig.height=4, tidy=TRUE}

# Put comments on lines beginning with a single hash '#'. 
# Comments are visible to you but not executed.

# Load packages needed - need to do only once.

library(ggplot2)
```

Your first step will usually be to read in the data. In this example below, data are simulated instead. 

Generate 30 data points by randomly sampling a normal distribution (default mean = 0, sd = 1). Then make a new variable y that transforms x linearly and adds a random error. The random error is sampled randomly from a normal distribution with sd = 0.25 (mean = 0 is the default). Then plot.

```{r eval = TRUE, message=FALSE, warning=FALSE, fig.width=6, fig.height=4, tidy=TRUE}
# Write annotations here. For example, what data are you reading or generating? 
# Or, what does the next line of code do? 
x <- rnorm(30)
y <- 1 + 2*x + rnorm(30, sd=0.25)

# Plot the data in a simple scatterplot, no frills for this example.
plot(y ~ x)
```

***

## Step 2

Blah blah blah.

Sometimes you might want to include some code that is not executed to make a point. 

The following will produce a different plot. Let's show the code in the output but not its results.  

```{r eval = FALSE}

plot(x ~ y)

```

You might also want to include an image file in your document. Use the following format, where the text between curved parentheses is the "(/path_to_image/myimage.jpg)" on your local computer. In my example here, my path to the image is to an online image of the R logo.

![R logo](https://www.zoology.ubc.ca/~schluter/R/images/Rlogo.jpg)


***

## Conclusion

Blah blah blah.

