---
title: "Assignment A"
author: "YOUR NAME HERE"
output: html_document
---

In the last line of the code block below that loads in the LAWA data, change the `XY` to the last two digits of your student ID number. e.g. my student ID was 95024645, so I would replace XY with 45.

```{r, message=FALSE}
library(tidyverse)
library(lubridate)
vacc <- read_csv("https://www.massey.ac.nz/~jcmarsha/161122/data/vaccinations.csv")
he_ara_kotahi <- read_csv("https://www.massey.ac.nz/~jcmarsha/161122/data/he_ara_kotahi_one_year.csv")

### CHANGE ME!!!
lawa <- read_csv("https://www.massey.ac.nz/~jcmarsha/data/LAWA/lawaXY.csv", guess_max = 10000)
```

**MAKE SURE YOU CAN KNIT THIS DOCUMENT BEFORE YOU START**

## Exercise 1

### A1.1

Use `dplyr` to manipulate the data so that you have the **proportion immunised** (i.e. Immunised divided by Eligible) for each `DHB`, for each `Age`, and each `Date`. Save the result so you can use it for the remaining questions. *You should end up with a data frame containing variables for `DHB`, `Date`, `Age` and `Proportion` with 5787 observations.*

```{r}

```

### A1.2

One of the health targets for immunisation was having 95% of 8 month olds immunised. Which DHBs have met this target, and how often have they met it?

```{r}

```

### A1.3

Produce a plot of the proportion immunised at 8 months for each DHB through time, comparing them to the 95% health target.

```{r}

```

### A1.4

Choose **ONE (1)** DHB (e.g. perhaps where you grew up, if you did so in NZ, or where a friend or family grew up if not from NZ) and produce a plot to demonstrate how that DHB is tracking over time for all age groups.

```{r}

```

## Exercise 2

### A2.1

What is this code doing? Detail the purpose of each command in the pipeline.

```{r}
lawa_to_plot <- lawa %>% filter(!is.na(TURB), TURB > 0) %>%
  group_by(SiteID) %>%
  filter(n() > 50) %>%
  mutate(DayOfYear = yday(Date))
```

WRITE YOUR ANSWER HERE

### A2.2

Use the `lawa_to_plot` dataset to produce the plot:

```{r}

```

## Exercise 3

## A3.1

Create a table of the mean daily counts over the bridge (regardless of direction) for each day of the week by each mode (pedestrian or cyclist).

```{r}

```

### A3.2

Create a table of the total monthly counts over the bridge (regardless of direction) for each month by each mode (pedestrian or cyclist).

```{r}

```

### A3.3

Find the date on which the running event was held using the code block below.

```{r}
```
