-
Notifications
You must be signed in to change notification settings - Fork 16
/
11_exercise_timeseries.Rmd
46 lines (32 loc) · 1.1 KB
/
11_exercise_timeseries.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
---
title: "Exercise: Simple Interactivity"
subtitle: "ggplotly & Time Series"
output: html_document
---
In this exercise the starter code to generate a simple time series plot is provided. Your task is to make the basic static plot an interactive plot. Execute the following code. Fill in the code for the final code chunk below.
## Library Packages
```{r}
library(tidyverse)
library(plotly)
```
## Data
```{r}
duke_ncaa_forcast <-
read_csv("https://raw.githubusercontent.com/fivethirtyeight/data/master/historical-ncaa-forecasts/historical-538-ncaa-tournament-model-results.csv",
col_types = cols(year = col_date(format = "%Y"), favorite_win_flag = col_logical())) %>%
filter(favorite == "Duke", round < 3)
duke_ncaa_forcast
```
## ggplot2
```{r}
duke_2ndround_win_probability <-
ggplot(duke_ncaa_forcast, aes(x = year, y = favorite_probability)) +
geom_point(aes(color = favorite_win_flag,
shape = favorite_win_flag), size = 4) +
geom_line()
duke_2ndround_win_probability
```
## Plotly via ggplotly
In the code chunk, below, make the above plot a plotly plot
```{r}
```