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

# Part 1

Load the libraries

```{r, message=FALSE}
library(readr)
library(ggplot2)
library(dplyr)
library(jhur)
```

Read Bike Lanes Dataset using `read_bike()` function from `jhur` package. Assign it to `bike` variable. 

Then, use the provided code to compute a data frame `bike_agg` with aggregate summary of bike lanes: average length of lanes (`lane_avg_length`) for each year (`dateInstalled`). 

```{r}
bike <- read_bike()

bike_agg <- bike %>%
  # filter data to keep only these observations for which year is non-0
  filter(dateInstalled != 0) %>%
  group_by(dateInstalled) %>%
  summarise(lane_avg_length = mean(length))

bike_agg
```

### 1.1

Use `ggplot2` package make plot of average length of lanes (`lane_avg_length`; y-axis) for each year (`dateInstalled`; x-axis). You can use lines layer (`+ geom_line()`) or points layer (`+ geom_point()`), or both!

Assign the plot to variable `my_plot`. Type `my_plot` in the console to have it displayed.

```
# General format
ggplot(???, aes(x = ???, y = ???)) +
  ??? +
  ???
```

```{r 1.1response}

```

### 1.2

"Update" your plot by adding a title and changing the x and y axis titles. 

```{r 1.2response}

```

### 1.3

Use the `scale_x_continuous()` function to plot the x axis with the following breaks `c(2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013)`. 

```
# General format
my_plot<- my_plot +
  scale_x_continuous(?????)
```

```{r 1.3response}

```

### 1.4

Observe several different versions of the plot by displaying `my_plot` while adding a different "theme" to it. 

```
# General format
my_plot + theme_bw()
```

```{r 1.4response}

```


# Practice on Your Own!

### P.1

Create a boxplot (with the `geom_boxplot()` function) using the `Orange` data, where `Tree` is plotted on the x axis and `circumference` is plotted on the y axis. 

```{r P1response}

```

Notice how the trees are ordered. We will learn more about this soon!


# Part 2

### 2.1

Use the provided code to compute a data frame `bike_agg_2` with aggregate summary of bike lanes: number of lanes (`lane_count`) -- separately for each year (`dateInstalled`) and for each lane type. 

```{r}
bike_agg_2 <- bike %>%
  filter(dateInstalled != 0) %>%
  group_by(dateInstalled, type) %>%
  summarise(lane_count = n())

bike_agg_2
```

### 2.2

Use `ggplot2` package to make a plot showing trajectories of number of lanes (`lane_count`; y-axis) over year (`dateInstalled`; x-axis), where each bike line type has a different color (hint: use `color = type` in mapping).

```
# General format
ggplot(???, aes(
  x = ???,
  y = ???,
  color = ???
)) +
  geom_line() +
  geom_point()
```

```{r 2.2response}

```

### 2.3

Redo the above plot by adding a faceting  (`+ facet_wrap( ~ type, ncol = 3)`) to have data for each bike line type in a separate plot panel. 

(You may see `geom_path: Each group consists of only one observation. Do you need to adjust the group aesthetic?` warning as some bike lane types will have only 1 point plotted while trying to plot a line).
Assign the new plot as an object called `facet_plot`.

```{r 2.3response}

```

### 2.4

Observe what happens when you remove either `geom_line()` OR `geom_point()` from one of your plots above.

```{r 2.4response}

```


# Practice on Your Own!

### P.2

Modify `facet_plot` to remove the legend (hint use `theme()` and the `legend.position` argument) and change the names of the axis titles to be "Number of bike lanes" for the y axis and "Date bike lane was installed" for the x axis. 

```{r P.2response}

```

### P.3

Modify `facet_plot` one more time with a fun theme! Look into the [ThemePark package](https://github.com/MatthewBJane/ThemePark) It has lots of fun themes! Try one out! Remember you will need to install it using `remotes::install_github("MatthewBJane/ThemePark")`and load in the library. 

```{r P.3response}

```
