-
Notifications
You must be signed in to change notification settings - Fork 0
/
.Rhistory
437 lines (437 loc) · 20.8 KB
/
.Rhistory
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
'Hello World!'
22/7
install.packages("tidyverse")
library(tidyverse)
ggplot2::mpg
View(mpg)
summary(mpg)
?mpg
ggplot(data = mpg) + geom_point(mapping =aes(x = displ, y = hwy))
ggplot(data = mpg) + geom_point(mapping = aes(x = displ, y = hwy, color=class))
ggplot(data = mpg) + geom_point(mapping = aes(x = displ, y = hwy, shape=class))
ggplot(data = mpg) + geom_point(mapping = aes(x = displ, y = hwy))+ facet_wrap(~class,nrows=2)
ggplot(data = mpg) + geom_point(mapping = aes(x = displ, y = hwy))+ facet_wrap(~class,nrow=2)
ggplot(data = mpg) + geom_smooth(mapping = aes(x = displ, y = hwy))
ggplot(data = mpg) + geom_smooth(mapping = aes(x = displ, y = hwy, group = drv))
ggplot(data = mpg) + geom_smooth(mapping = aes(x = displ, y = hwy,color=drv,show.legend=TRUE))
ggplot(data = mpg, mapping = aes(x = displ, y = hwy))
ggplot(data = mpg, mapping = aes(x = displ, y = hwy)) +geom_point()+geom_smooth()
ggplot(data = mpg, mapping = aes(x = displ, y = hwy)) +geom_point(color=class)+geom_smooth()
ggplot(data = mpg, mapping = aes(x = displ, y = hwy)) +geom_point(color=class)+geom_smooth()
ggplot(data = mpg, mapping = aes(x = displ, y = hwy,color=class)) +geom_point()+geom_smooth()
ggplot(data = mpg, mapping = aes(x = displ, y = hwy)) +geom_point(mapping=aes(color=class))+geom_smooth()
ggplot(data = mpg, mapping = aes(x = displ, y=hwy)) +
geom_point(mapping = aes(color = class)) +
geom_smooth(
data = filter(mpg, class == "subcompact"),
se = FALSE
)
WineDataset <- read.csv("~/Desktop/DS/WineDataset.txt")
View(WineDataset)
wd <- WineDataset
ggplot(data=wd)+geom_point(mapping =aes(x = Alcohol, y = Flavanoids))
ggplot(data=wd)+geom_point(mapping =aes(x = Alcohol, y = Flavanoids,color=class))
ggplot(data=wd)+geom_point(mapping =aes(x = Alcohol, y = Flavanoids, color=class))
ggplot(data=wd)+geom_point(mapping =aes(x = Alcohol, y = Flavanoids, color=Class))
ggplot(data = wd, mapping = aes(x = TotalPhenols, y = Flavanoids)) +geom_point(mapping=aes(color=class))+geom_smooth()
ggplot(data = wd, mapping = aes(x = TotalPhenols, y = Flavanoids)) +geom_point(mapping=aes(color=Class))+geom_smooth()
ggplot(data = wd) + geom_point(mapping = aes(x = TotalPhenols, y = Flavanoids))+ facet_wrap(~Class,nrow=3)
ggplot(data = wd, mapping = aes(x = TotalPhenols, y = Flavanoids)) +geom_point(mapping=aes(color=Class))+geom_smooth()
summary(wd)
summary(wd,Class=3)
summary(wd(Class=3))
summary(wd,(Class=3))
## Answer the questions for the group activity and show your code here:
library(tidyverse)
ggplot(data = wd, mapping = aes(x = TotalPhenols, y = Flavanoids)) +geom_point(mapping=aes(color=Class))+geom_smooth()
ggplot(data=wd)+geom_point(mapping =aes(x = Alcohol, y = Flavanoids, color=Class))
ggplot(data = mpg) + geom_point(mapping =aes(x = displ, y = hwy), position = "jitter")
ggplot(data=mpg) +
stat_summary(
mapping = aes(x = class, y = displ),
fun.ymin = min,
fun.ymax = max,
fun.y = median
)
ggplot(data = mpg) + geom_bar(mapping = aes(x = class, fill = class))
ggplot(data = mpg) + geom_bar(mapping = aes(x = class, color = class))
ggplot(data = mpg) + geom_bar(mapping = aes(x = class, fill = class))
ggplot(data = mpg, mapping = aes(x = class, y = hwy))
ggplot(data = mpg) + geom_bar(mapping = aes(x = class, color = class))
ggplot(data=mpg) +
stat_summary(
mapping = aes(x = class, y = displ),
fun.ymin = min,
fun.ymax = max,
fun.y = median
)
ggplot(data = mpg) + geom_bar(mapping = aes(x = class, fill = class))
ggplot(data = mpg) + geom_bar(mapping = aes(x = class, color = class))
ggplot(data = mpg, mapping = aes(x = class, y = hwy))
ggplot(data=diamonds) + geom_bar(mapping = aes(x = cut))
ggplot(data = mpg, mapping = aes(x = class, y = hwy)) + geom_boxplot()
### <CODE GOES HERE>
ggplot(data = mpg, mapping = aes(x = class, y = hwy)) + geom_boxplot()+ coord_flip()
## load the "diamonds" dataset included with the ggplot2 package:
ggplot::diamonds
## load the "diamonds" dataset included with the ggplot2 package:
ggplot2::diamonds
summary(diamonds)
?diamonds
ggplot(data=diamonds) + geom_bar(mapping = aes(x = cut))
ggplot(data = diamonds) + geom_bar(mapping = aes(x = cut, y= ..prop.., group=1))
ggplot(data=diamonds) + geom_bar(mapping = aes(x = cut, color = cut))
ggplot(data=diamonds) + geom_bar(mapping = aes(x = cut, fill = cut))
ggplot(data = diamonds, mapping = aes(x = cut, fill = clarity))
ggplot(data=diamonds) + geom_bar(mapping = aes(x = cut, fill = cut))
ggplot(data=diamonds) + geom_bar(mapping = aes(x = cut, fill = clarity))
ggplot(data = diamonds, mapping = aes(x = cut, fill = clarity)) + geom_bar(position="dodge")
summary(mpg)
ggplot(data = mpg, mapping = aes(x = drv, fill = clarity)) + geom_bar(position="dodge")
ggplot(data = mpg, mapping = aes(x = drv, fill = cyl)) + geom_bar(position="dodge")
ggplot(data = mpg, mapping = aes(x = drv)) + geom_bar(position="dodge")
ggplot(data = mpg, mapping = aes(x = drv))
ggplot(data = mpg, mapping = aes(x = drv)) + geom_bar(position="dodge")
L= mgp$class== suv
L= mpg$class== suv
L= mpg$class== 'suv'
L
ggplot(data = mpg[L,], mapping = aes(x = drv)) + geom_bar(position="dodge")
ggplot(data = mpg[L,], mapping = aes(x = drv, color = drv)) + geom_bar(position="dodge")
ggplot(data = mpg[L,], mapping = aes(x = drv, fill = drv)) + geom_bar(position="dodge")
library(tidyverse)
library(dplyr)
x <- 6*3
x
x
x
x x
x +x
install.packages("nycflights13")
library(nycflights13)
library(tidyverse)
## Let's dive deeper into the filter() function:
filter(flights, month == 1, day ==1)
?nycflights13
??nycflights13
## The nycflights13 data contains all (what # of) flights that departed from New York City in 2013
## Source:US Bureau of Transportation
summarise(nycflights13)
## The nycflights13 data contains all (what # of) flights that departed from New York City in 2013
## Source:US Bureau of Transportation
summarise(flights)
## The nycflights13 data contains all (what # of) flights that departed from New York City in 2013
## Source:US Bureau of Transportation
flights
?flights
summary(wd)
View(mpg)
library(tidyverse)
ggplot2::mpg
View(mpg)
ggplot(data = mpg) + geom_point(mapping = aes(x = displ, y = hwy))+ facet_wrap(~class,nrow=2)
ggplot(data = mpg) + geom_point(mapping = aes(x = displ, y = hwy))+ facet_wrap(~year,nrow=2)
ggplot(data = mpg) + geom_point(mapping = aes(x = displ, y = hwy))+ facet_wrap(~city,nrow=2)
ggplot(data = mpg) + geom_point(mapping = aes(x = displ, y = hwy))+ facet_wrap(~cty,nrow=2)
ggplot(data = mpg) + geom_point(mapping = aes(x = cty, y = hwy))+ facet_wrap(~displ,nrow=2)
ggplot2::msleep
sleep = msleep
sleep <- msleep
flights
## The nycflights13 data contains all (what # of) flights that departed from New York City in 2013
## Source:US Bureau of Transportation
flights
library(nycflights13)
library(tidyverse)
?nycflights13
## The nycflights13 data contains all (what # of) flights that departed from New York City in 2013
## Source:US Bureau of Transportation
flights
arrange(flights, desc(arr_delay))
arrange(flights, desc(arr_delay, day))
arrange(flights, desc(month, day))
?flights
arrange(flights, desc(day,month))
arrange(flights, desc(day))
arrange(flights, desc(day,dep_delay))
arrange(flights,day,dep_delay)
install.packages("nycflights13")
library(nycflights13)
library(tidyverse)
flights
?flights
flights
newFlights <- mutate(flights,
new_delay=sched_dep_time-dep_time
)
newFlights
arrange(newFlighst,desc(new_delay))
arrange(newFlights,desc(new_delay))
transmute(flights,
dep_time,
hour = dep_time %/% 100,
minute = dep_time %% 100
)
newFlights <- transmute(flights,
dep_time,
sched_dep_time,
dep_delay,
new_delay=dep_time-sched_dep_time
)
arrange(newFlights,desc(new_delay))
newFlights <- transmute(flights,
dep_time,
sched_dep_time,
dep_delay,
new_delay=dep_time-sched_dep_time)
## 2.) (15 pts. total) Remember the struggle we had last week when we tried to plot
## a bar plot representing the distribution of drive (front-wheel, rear-wheel, four-wheel)
## for SUVs only? Now take advantage of the fliter() and/or select() functions and
## use in conjunction with your ggplot command in order to create this plot properly.
## Submit your plot in addition to your code, either by saving it or by taking a
## screenshot. Make sure your last name and Week3Assignment are in the title.
ggplot2::mpg
ggplot(data = mpg, mapping = aes(x = displ, y=hwy)) +
geom_point(mapping = aes(color = class)) +
geom_smooth(
data = filter(mpg, class == "subcompact"),
se = FALSE
)
ggplot(data = mpg, mapping = aes(x = class, y = hwy)) +
geom_boxplot()
ggplot(data = mpg[L,], mapping = aes(x = drv, fill = drv)) + geom_bar(position="dodge")
ggplot(data = filter(mpg,class==suv), mapping = aes(x = drv, fill = drv)) + geom_bar(position="dodge")
ggplot(data = filter(mpg,class=='suv'), mapping = aes(x = drv, fill = drv)) + geom_bar(position="dodge")
#### AND FINALLY A NEW DATASET! #################################################
## LOAD THE MSLEEP DATASET:
ggplot2::msleep
arrage(msleep,desc(sleep_total))
arrange(msleep,desc(sleep_total))
ggplot(data = mpg) + geom_smooth(mapping = aes(x = displ, y = hwy))
ggplot(data = mpg) + geom_smooth(mapping = aes(x = displ, y = hwy, group = drv))
ggplot(data = mpg) + geom_smooth(mapping = aes(x = displ, y = hwy,color=drv,show.legend=TRUE))
ggplot(data = mpg, mapping = aes(x = displ, y = hwy)) +geom_point(mapping=aes(color=class))+geom_smooth()
ggplot(data = mpg) + geom_point(mapping =aes(x = displ, y = hwy), position = "jitter")
ggplot(data=msleep)+ geom_point(mapping=aes(x=sleep_total,y= sleep_rem))
ggplot(data=msleep)+ geom_point(mapping=aes(x=sleep_total,y= sleep_rem,color=genus))
ggplot(data=msleep)+ geom_point(mapping=aes(x=sleep_total,y= sleep_rem,color=vore))
#The animal that sleeps the most is the Little brown bat
msleep?
ggplot(data=msleep)+ geom_point(mapping=aes(x=sleep_total,y= sleep_rem))
#The animal that sleeps the most is the Little brown bat
msleep?
ggplot(data=msleep)+ geom_point(mapping=aes(x=sleep_total,y= sleep_rem))
#The animal that sleeps the most is the Little brown bat
?msleep
ggplot(data=msleep)+ geom_point(mapping=aes(x=sleep_rem,y= sleep_cycle))
ggplot(data=msleep)+ geom_point(mapping=aes(y=sleep_rem,x= sleep_cycle))
newSleep<-transmute(msleep,
name,
sleep_total,
percentSleeping=sleep_total/24,
bodyBrainRation=bodywt/brainwt
)
newSleep
newSleep<-transmute(msleep,
name,
sleep_total,
percentSleeping=sleep_total/24,
bodyBrainRatio=bodywt/brainwt
)
newSleep
ggplot(data=newSleep)+ geom_point(mapping=aes(y=sleepTotal,x= bodyBrainRatio))
ggplot(data=newSleep)+ geom_point(mapping=aes(y=sleep_total,x= bodyBrainRatio))
transmute(flights,
dep_time,
hour = dep_time %/% 100,
minute = dep_time %% 100
)
library(nycflights13)
library(tidyverse)
flights
?flights
transmute(flights,
dep_time,
hour = dep_time %/% 100,
minute = dep_time %% 100
)
#dep_delay should be equal to dep_time-sched_dep_time
time<-mutate(flights,
dep_time = dep_time%/%100*60+dep_time%%100,
sched_dep_time= sched_dep_time%/%100*60+sched_dep_time%%100
)
newFlights <- transmute(time,
dep_delay,
new_delay=dep_time-sched_dep_time)
arrange(newFlights,desc(new_delay))
#my hypothesis is that having a longer sleep cycle will result in having less rem sleep.
#using the plot created below you can see there is a correlation between the two as the trend is sloping down
ggplot(data=msleep)+ geom_point(mapping=aes(y=sleep_rem,x= sleep_cycle))
newFlights
view(newFlights)
View(newFlights)
### Looking at summarize() and group_by() ##################
nycflights13::flights
by_day <- group_by(flights, year, month, day)
View(by_day)
summarize(by_day, delay = mean(dep_delay, na.rm = TRUE))
by_dest <- group_by(flights, dest)
delay <- summarize(by_dest,count = n(),
dist = mean(distance, na.rm = TRUE),
delay = mean(arr_delay, na.rm = TRUE)
)
delay
delay <- filter(delay, count >20, dest != "HNL")
ggplot(data = delay, mapping = aes(x = dist, y = delay)) +
geom_point(aes(size = count)) +
geom_smooth(se = FALSE)
## Let's make a dataframe that represents only flights that actually flew"
not_cancelled <- flights%>%
filter(flights, dep_delay != "NA")
## Let's make a dataframe that represents only flights that actually flew"
not_cancelled <- flights%>%
filter(flights, dep_delay is.na())
## Let's make a dataframe that represents only flights that actually flew"
not_cancelled <- flights%>%
filter(flights, is.na(dep_time))
## Let's make a dataframe that represents only flights that actually flew"
not_cancelled <- flights%>%
filter(flights, is.na(dep_time)==FALSE)
## Let's make a dataframe that represents only flights that actually flew"
not_cancelled <- flights%>%
filter(is.na(dep_time)==FALSE)
## Let's make a dataframe that represents only flights that actually flew"
not_cancelled <- flights%>%
filter(is.na(dep_time)==TRUE)
## Let's make a dataframe that represents only flights that actually flew"
not_cancelled <- flights%>%
filter(is.na(dep_time)==FALSE)
## Let's make a dataframe that represents only flights that actually flew"
not_cancelled <- flights%>%
filter(!is.na(dep_time))
not_cancelled %>%
group_by(dest) %>%
summarize(carriers = n_distinct(carrier)) %>%
arrange(desc(carriers))
## 1.) Find all destinations that are flown by at least two carriers.
not_cancelled %>%
group_by(dest) %>%
summarize(carriers = n_distinct(carrier)) %>%
arrange(desc(carriers))
not_cancelled %>%
count(dest)
## 1.) Find all destinations that are flown by at least two carriers.
not_cancelled %>%
group_by(dest) %>%
summarize(carriers = n_distinct(carrier)) %>%
arrange(desc(carriers)) %>%
filter(carriers>1)
View(not_cancelled)
not_cancelled %>%
group_by(flight) %<%
summarize(min_delay= min(arr_delay)) %<%
filter(min_delay == 10)
not_cancelled %>%
group_by(flight) %>%
summarize(min_delay= min(arr_delay)) %>%
filter(min_delay == 10)
not_cancelled %>%
group_by(flight) %>%
summarize(min_delay= min(arr_delay)) %>%
summarize(max_delay = max(arr_delay)) %>%
filter(min_delay == 10& max_delay==10)
not_cancelled %>%
group_by(flight) %>%
summarize(min_delay= min(arr_delay)) %>%
summarize(max_delay = max(arr_delay)) %>%
filter(min_delay == 10 & max_delay==10)
not_cancelled %>%
group_by(flight) %>%
summarize(min_delay= min(arr_delay)) %>%
filter(min_delay >= 10)
## 1.) Find all destinations that are flown by at least two carriers.
not_cancelled %>%
group_by(dest) %>%
summarize(carriers = n_distinct(carrier)) %>%
arrange(desc(carriers)) %>%
filter(carriers>1)
install.packages(knitr)
install.packages("knitr")
library(knitr)
knitr::opts_chunk$set(echo = TRUE)
ggplot(data=mpg) +
stat_summary(
mapping = aes(x = class, y = displ),
fun.ymin = min,
fun.ymax = max,
fun.y = median
)
ggplot(data = mpg) + geom_point(mapping = aes(x = displ, y = hwy, color=class))
library(ggplot)
library(tidyverse)
library(ggplot2)
ggplot(data = mpg) + geom_point(mapping =aes(x = displ, y = hwy), position = "jitter")
library(tidyverse)
1
123
packages.install('varhandle')
install.packages(varhandle)
install.packages('varhandle')
install.packages('gridExtra')
map <- get_map(location=c(lon=-87.645167,lat=41.808013), zoom=11, maptype='roadmap', color='bw')#Get the map from Google Maps
library(tidyverse)
library(ggplot2)
library(lubridate)
library(ggplot2)
library(ggmap)
library(dplyr)
library(data.table)
library(ggrepel)
map <- get_map(location=c(lon=-87.645167,lat=41.808013), zoom=11, maptype='roadmap', color='bw')#Get the map from Google Maps
map <- get_map(location=c(lon=-87.645167,lat=41.808013), zoom=11, maptype='roadmap', api_key='AIzaSyBOnSvd9M9waO2CKqKaq9pB794slabDTjc',color='bw')#Get the map from Google Maps
map <- get_map(location=c(lon=-87.645167,lat=41.808013), zoom=11, maptype='roadmap', api_key='AIzaSyBOnSvd9M9waO2CKqKaq9pB794slabDTjc',color='bw')#Get the map from Google Maps
map <- get_map(location=c(lon=-87.645167,lat=41.808013), zoom=11, maptype='roadmap',color='bw')#Get the map from Google Maps
map <- get_map(location=c(lon=-87.645167,lat=41.808013), zoom=11, maptype='roadmap',api_key='AIzaSyC9rrtr993vzkQlEF3HfYdzwcj0ojOnLzA',color='bw')#Get the map from Google Maps
map <- get_map(location=c(lon=-87.645167,lat=41.808013), zoom=11, maptype='roadmap',api_key='AIzaSyC9rrtr993vzkQlEF3HfYdzwcj0ojOnLzA',color='bw')#Get the map from Google Maps
map <- get_map(location=c(lon=-87.645167,lat=41.808013), zoom=11, maptype='roadmap',api_key='AIzaSyC9rrtr993vzkQlEF3HfYdzwcj0ojOnLzA',color='bw')#Get the map from Google Maps
map <- get_map(location=c(lon=-87.645167,lat=41.808013), zoom=11, maptype='roadmap',api_key='AIzaSyC9rrtr993vzkQlEF3HfYdzwcj0ojOnLzA',color='bw')#Get the map from Google Maps
map <- get_map(location=c(lon=-87.645167,lat=41.808013), zoom=11, maptype='roadmap',api_key='AIzaSyC9rrtr993vzkQlEF3HfYdzwcj0ojOnLzA',color='bw')#Get the map from Google Maps
map <- get_map(location=c(lon=-87.645167,lat=41.808013), zoom=11, maptype='roadmap',color='bw')#Get the map from Google Maps
map <- get_map(location=c(lon=-87.645167,lat=41.808013), zoom=11, maptype='roadmap',color='bw')#Get the map from Google Maps
map <- get_map(location=c(lon=-87.645167,lat=41.808013), zoom=11, maptype='roadmap',color='bw')#Get the map from Google Maps
map <- get_map(location=c(lon=-87.645167,lat=41.808013), zoom=11, maptype='roadmap',color='bw')#Get the map from Google Maps
map <- get_map(location=c(lon=-87.645167,lat=41.808013),api_key='AIzaSyC9rrtr993vzkQlEF3HfYdzwcj0ojOnLzA', zoom=11, maptype='roadmap',color='bw')#Get the map from Google Maps
map <- get_map(location=c(lon=-87.645167,lat=41.808013),api_key='AIzaSyC9rrtr993vzkQlEF3HfYdzwcj0ojOnLzA', zoom=11, maptype='roadmap',color='bw')#Get the map from Google Maps
map <- get_map(location=c(lon=-87.645167,lat=41.808013),api_key='AIzaSyC9rrtr993vzkQlEF3HfYdzwcj0ojOnLzA', zoom=11, maptype='roadmap',color='bw')#Get the map from Google Maps
map <- get_map(location=c(lon=-87.645167,lat=41.808013),api_key='AIzaSyC9rrtr993vzkQlEF3HfYdzwcj0ojOnLzA', zoom=11, maptype='roadmap',color='bw')#Get the map from Google Maps
map <- get_map(location=c(lon=-87.645167,lat=41.808013),api_key='AIzaSyC9rrtr993vzkQlEF3HfYdzwcj0ojOnLzA', zoom=11, maptype='roadmap',color='bw')#Get the map from Google Maps
map <- get_map(location=c(lon=-87.645167,lat=41.808013),api_key='AIzaSyC9rrtr993vzkQlEF3HfYdzwcj0ojOnLzA', zoom=11, maptype='roadmap',color='bw')#Get the map from Google Maps
map <- get_map(location=c(lon=-87.645167,lat=41.808013)key='AIzaSyC9rrtr993vzkQlEF3HfYdzwcj0ojOnLzA', zoom=11, maptype='roadmap',color='bw')#Get the map from Google Maps
map <- get_map(location=c(lon=-87.645167,lat=41.808013),key='AIzaSyC9rrtr993vzkQlEF3HfYdzwcj0ojOnLzA', zoom=11, maptype='roadmap',color='bw')#Get the map from Google Maps
map <- get_map(location=c(lon=-87.645167,lat=41.808013),api_key='AIzaSyC9rrtr993vzkQlEF3HfYdzwcj0ojOnLzA', zoom=11, maptype='roadmap',color='bw')#Get the map from Google Maps
map <- get_googlemap(location=c(lon=-87.645167,lat=41.808013),key='AIzaSyC9rrtr993vzkQlEF3HfYdzwcj0ojOnLzA', zoom=11, maptype='roadmap',color='bw')#Get the map from Google Maps
##1) Create a map with all of the crime locations plotted.
p <- ggmap(get_googlemap(center = c(lon = -87.645167, lat = 41.808013),
zoom = 11, scale = 2,
maptype ='terrain',
color = 'color',
key='AIzaSyC9rrtr993vzkQlEF3HfYdzwcj0ojOnLzA'
))
map <- get_googlemap(location=c(lon=-87.645167,lat=41.808013),key='AIzaSyC9rrtr993vzkQlEF3HfYdzwcj0ojOnLzA', zoom=11, maptype='roadmap',color='bw')#Get the map from Google Maps
download.file('https://maps.googleapis.com/maps/api/staticmap?center=29.763284,-95.363271&zoom=11&size=640x640&scale=2&maptype=roadmap',destfile=destfile,mode ="wb")
map <- 0
download.file('https://maps.googleapis.com/maps/api/staticmap?center=29.763284,-95.363271&zoom=11&size=640x640&scale=2&maptype=roadmap',destfile=map,mode ="wb")
download.file('https://maps.googleapis.com/maps/api/staticmap?center=29.763284,-95.363271&zoom=11&size=640x640&scale=2&maptype=roadmap',destfile='map',mode ="wb")
download.file('https://maps.googleapis.com/maps/api/staticmap?center=29.763284,-95.363271&zoom=11&key=AIzaSyC9rrtr993vzkQlEF3HfYdzwcj0ojOnLzA&size=640x640&scale=2&maptype=roadmap',destfile='map',mode ="wb")
setwd("~/Desktop/DS/Project1")
map <- get_googlemap(location=c(lon=-87.645167,lat=41.808013),key='AIzaSyC9rrtr993vzkQlEF3HfYdzwcj0ojOnLzA', zoom=11, maptype='roadmap',color='bw')#Get the map from Google Maps
download.file('https://maps.googleapis.com/maps/api/staticmap?center=29.763284,-95.363271&zoom=11&key=AIzaSyC9rrtr993vzkQlEF3HfYdzwcj0ojOnLzA&size=640x640&scale=2&maptype=roadmap',destfile='map',mode ="wb")
map <- get_googlemap(location=c(lon=-87.645167,lat=41.808013),key='AIzaSyC9rrtr993vzkQlEF3HfYdzwcj0ojOnLzA', zoom=11, maptype='roadmap',color='bw')#Get the map from Google Maps
register_google(key = "AIzaSyC9rrtr993vzkQlEF3HfYdzwcj0ojOnLzA")
map <- get_googlemap(location=c(lon=-87.645167,lat=41.808013),key='AIzaSyC9rrtr993vzkQlEF3HfYdzwcj0ojOnLzA', zoom=11, maptype='roadmap',color='bw')#Get the map from Google Maps
knitr::opts_chunk$set(echo = TRUE)
register_google(key = "AIzaSyC9rrtr993vzkQlEF3HfYdzwcj0ojOnLzA")
map <- get_map(location=c(lon=-87.645167,lat=41.808013), zoom=11, maptype='roadmap', color='bw')#Get the map from Google Maps
register_google(key = "AIzaSyC9rrtr993vzkQlEF3HfYdzwcj0ojOnLzA")
map <- get_map(location=c(lon=-87.645167,lat=41.808013), zoom=11, maptype='roadmap', color='bw')#Get the map from Google Maps
install.packages("XQuartz")