-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathHackathon.Rmd
More file actions
69 lines (46 loc) · 1.13 KB
/
Hackathon.Rmd
File metadata and controls
69 lines (46 loc) · 1.13 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
---
title: "Hackathon"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## Loading libraries:
```{r}
library(tidyverse)
library(tidymodels)
library(leaflet)
library(sf)
```
# Loading data:
```{r}
cali_nhood_safegraph <- read_csv("data/cali_nhood_safegraph.csv")
la_cb <- read_csv("data/la_cb.csv")
la_crime_june <- read_csv("data/la_crime_june.csv")
retrosheet_gl_2018 <- read_csv("data/retrosheet_gl_2018.csv")
stadium_coords <- read_csv("data/stadium_coords.csv")
us_crime_2018 <- read_csv("data/us_crime_2018.csv")
```
# Mapping out stadiums:
```{r}
leaflet(stadium_coords) %>%
addTiles() %>%
addMarkers(lat= stadium_coords$y, lng= stadium_coords$x,
label = stadium_coords$stadium_name)
```
# Pre-processing/data cleaning:
```{r}
retrosheet_gl_2018 %>%
filter(name == "Dodger Stadium") %>%
mutate(date = lubridate::ymd(date))
```
## From David:
```{r}
Dodgers_games <- read_csv("data/Dodgers_games.csv")
Dodgers_games %>%
transmute(Game,
date = lubridate::mdy(`Date / Box Score`),
Score,
Decision,
Record)
```