-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.Rhistory
512 lines (512 loc) · 23.4 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
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
breaks = scales::pretty_breaks(n=10)) +
theme_minimal() +
theme(axis.text = element_blank(),
axis.title = element_blank(),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank()) +
labs(title = "Population by Census Tract\nSan Antonio & Bexar County (2010)",
caption = "Source: ACS 5-Year Estimate, 2010")
# Map
ggplot(data = pop_2010) +
geom_sf(aes(fill = estimate)) +
scale_fill_distiller(palette = "Spectral", direction = -1,
name = "Population Totals\n2010",
breaks = scales::pretty_breaks(n=10)) +
theme_minimal() +
theme(axis.text = element_blank(),
axis.title = element_blank(),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank()) +
labs(title = "Population by Census Tract\nSan Antonio & Bexar County (2010)",
caption = "Source: ACS 5-Year Estimate, 2010")
# Map 2019
ggplot(data = pop_2019) +
geom_sf(aes(fill = estimate)) +
scale_fill_distiller(palette = "Spectral", direction = -1,
name = "Population Totals\n2019",
breaks = scales::pretty_breaks(n=10)) +
theme_minimal() +
theme(axis.text = element_blank(),
axis.title = element_blank(),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank()) +
labs(title = "Population by Census Tract\nSan Antonio & Bexar County (2019)",
caption = "Source: ACS 5-Year Estimate, 2019")
pop_2019 <- get_acs(geography = "tract", variables = "B01003_001",
year = 2019, survey = "acs5",
state = "TX", county = "Bexar", geometry = TRUE)
# Map 2019
ggplot(data = pop_2019) +
geom_sf(aes(fill = estimate)) +
scale_fill_distiller(palette = "Spectral", direction = -1,
name = "Population Totals\n2019",
breaks = scales::pretty_breaks(n=10)) +
theme_minimal() +
theme(axis.text = element_blank(),
axis.title = element_blank(),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank()) +
labs(title = "Population by Census Tract\nSan Antonio & Bexar County (2019)",
caption = "Source: ACS 5-Year Estimate, 2019")
# Map
ggplot(data = pop_2010) +
geom_sf(aes(fill = estimate)) +
scale_fill_distiller(palette = "Spectral", direction = -1,
name = "Population Totals\n2010",
breaks = scales::pretty_breaks(n=10)) +
theme_minimal() +
theme(axis.text = element_blank(),
axis.title = element_blank(),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank()) +
labs(title = "Population by Census Tract\nSan Antonio & Bexar County (2010)",
caption = "Source: ACS 5-Year Estimate, 2010")
# Map 2019
ggplot(data = pop_2019) +
geom_sf(aes(fill = estimate)) +
scale_fill_distiller(palette = "Spectral", direction = -1,
name = "Population Totals\n2019",
breaks = scales::pretty_breaks(n=10)) +
theme_minimal() +
theme(axis.text = element_blank(),
axis.title = element_blank(),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank()) +
labs(title = "Population by Census Tract\nSan Antonio & Bexar County (2019)",
caption = "Source: ACS 5-Year Estimate, 2019")
# Get population data for 2008 and 2022 - ZCTA
pop_2010 <- get_acs(geography = "zip code tabulation area", variables = "B01003_001", year = 2010)
# Get population data for 2008 and 2022 - ZCTA
pop_2010 <- get_acs(geography = "zcta", variables = "B01003_001", year = 2010)
# Get population data for 2008 and 2022 - ZCTA
pop_2010 <- get_acs(geography = "zcta", variables = "B01003_001", state = "TX", year = 2010)
# Get population data for 2008 and 2022 - ZCTA
pop_2010 <- get_acs(geography = "zcta", variables = "B01003_001", state = "TX", county="Bexar", year = 2010)
# Get population data for 2008 and 2022 - ZCTA
pop_2010 <- get_acs(geography = "tract", variables = "B01003_001", year = 2010) %>%
filter(grepl("Bexar", NAME))
# Get population data for 2008 and 2022 - ZCTA
pop_2010 <- get_acs(geography = "tract", variables = "B01003_001", year = 2010,state = "TX", county = "Bexar")
pop_2019 <- get_acs(geography = "tract", variables = "B01003_001", year = 2019,state = "TX", county = "Bexar")
# Calculate population percentage changes
pop_changes <- full_join(pop_2010, pop_2019, by="GEOID")
pop_changes$pct_change = ((pop_changes$estimate.y - pop_changes$estimate.x) / pop_changes$estimate.x) * 100
ggplot(data = pop_changes) +
geom_sf(aes(fill = pct_change), color = NA) +
scale_fill_gradient2(low = "lightblue", high = "red", midpoint = 0,
name = "Population % Increase\n(2010-2019)") +
theme_minimal() +
labs(title = "Population Percentage Increase by Census Tract in San Antonio (2010-2019)",
caption = "Source: US Census Bureau")
# Get population data for 2008 and 2022 - ZCTA
pop_2010 <- get_acs(geography = "tract", variables = "B01003_001", year = 2010,state = "TX", county = "Bexar", geometry = TRUE)
pop_2019 <- get_acs(geography = "tract", variables = "B01003_001", year = 2019,state = "TX", county = "Bexar", geometry = TRUE)
# Calculate population percentage changes
pop_changes <- full_join(pop_2010, pop_2019, by="GEOID")
# Calculate population percentage changes
pop_changes <- st_join(pop_2010, pop_2019, by="GEOID")
pop_2019 <- get_acs(geography = "tract", variables = "B01003_001", year = 2019,state = "TX", county = "Bexar")
# Calculate population percentage changes
pop_changes <- full_join(pop_2010, pop_2019, by="GEOID")
pop_changes$pct_change = ((pop_changes$estimate.y - pop_changes$estimate.x) / pop_changes$estimate.x) * 100
ggplot(data = pop_changes) +
geom_sf(aes(fill = pct_change), color = NA) +
scale_fill_gradient2(low = "lightblue", high = "red", midpoint = 0,
name = "Population % Increase\n(2010-2019)") +
theme_minimal() +
labs(title = "Population Percentage Increase by Census Tract in San Antonio (2010-2019)",
caption = "Source: US Census Bureau")
ggplot(data = pop_changes) +
geom_sf(aes(fill = pct_change), color = NA) +
scale_fill_gradient2(low = "lightblue", high = "red", midpoint = 200,
name = "Population % Increase\n(2010-2019)") +
theme_minimal() +
labs(title = "Population Percentage Increase by Census Tract in San Antonio (2010-2019)",
caption = "Source: US Census Bureau")
ggplot(data = pop_changes) +
geom_sf(aes(fill = pct_change), color = NA) +
scale_fill_gradientn(colors = rev(brewer.pal(11, "RdBu")),
name = "Population % Increase\n(2010-2019)",
label = scales::percent) +
theme_minimal() +
labs(title = "Population Percentage Increase by Census Tract in San Antonio (2010-2019)",
caption = "Source: US Census Bureau")
# Map of over 100% increase
high_pct_change_data <- pop_changes %>%
filter(pct_change > 100)
# Over 100 % Map
ggplot(data = high_pct_change_data) +
geom_sf(aes(fill = pct_change), color = NA) +
scale_fill_gradientn(colors = rev(brewer.pal(11, "RdBu")),
name = "Population % Increase\n(2010-2019)",
label = scales::percent,
limits = c(100, max(high_pct_change_data$pct_change))) +
theme_minimal() +
labs(title = "Census Tracts with Over 100% Population Increase in San Antonio (2010-2019)",
caption = "Source: US Census Bureau")
# Over 100 % Map
ggplot() +
geom_sf(data = pop_changes, fill = NA, color = "grey") +
geom_sf(data = high_pct_change_data, aes(fill = pct_change), color = NA) +
scale_fill_gradientn(colors = rev(brewer.pal(11, "RdBu")),
name = "Population % Increase\n(2010-2019)",
label = scales::percent) +
theme_minimal() +
labs(title = "Census Tracts with Over 100% Population Increase in San Antonio (2010-2019)",
caption = "Source: US Census Bureau")
# Over 100 % Map
ggplot() +
geom_sf(data = pop_changes, fill = NA, color = "grey") +
geom_sf(data = high_pct_change_data, aes(fill = pct_change), color = NA) +
scale_fill_gradientn(colors = rev(brewer.pal(11, "RdBu")),
name = "Population % Increase\n(2010-2019)",
label = scales::percent_format(scale=1)) +
theme_minimal() +
labs(title = "Census Tracts with Over 100% Population Increase in San Antonio (2010-2019)",
caption = "Source: US Census Bureau")
# Over 100 % Map
ggplot() +
geom_sf(data = pop_changes, fill = NA, color = "grey") +
geom_sf(data = high_pct_change_data, aes(fill = pct_change), color = NA) +
scale_fill_gradientn(colors = rev(brewer.pal(11, "RdBu")),
name = "Population % Increase\n(2010-2019)",
label = scales::percent_format(scale=1)) +
theme_minimal() +
theme(axis.text = element_blank(), axis.title = element_blank(), axis.ticks = element_blank()) +
labs(title = "Census Tracts with Over 100% Population Increase in San Antonio (2010-2019)",
caption = "Source: US Census Bureau")
# Filter data for tracts below 100% change
low_pct_change_data <- pop_changes %>%
filter(pct_change <= 100)
# Map
ggplot() +
geom_sf(data = pop_changes, fill = NA, color = "grey") +
geom_sf(data = low_pct_change_data, aes(fill = pct_change), color = NA) +
scale_fill_gradientn(colors = rev(brewer.pal(11, "RdBu")),
name = "Population % Increase\n(2010-2019)",
labels = scales::percent_format(scale = 1)) +
theme_minimal() +
theme(axis.text = element_blank(),
axis.title = element_blank(),
axis.ticks = element_blank()) +
labs(title = "Population Percentage Increase by Census Tract in San Antonio (2010-2019)",
caption = "Source: US Census Bureau")
# Map
ggplot() +
geom_sf(data = pop_changes, fill = NA, color = "grey") +
geom_sf(data = low_pct_change_data, aes(fill = pct_change), color = NA) +
scale_fill_gradientn(colors = rev(brewer.pal(11, "RdBu")),
name = "Population % Changes\n(2010-2019)",
labels = scales::percent_format(scale = 1)) +
theme_minimal() +
theme(axis.text = element_blank(),
axis.title = element_blank(),
axis.ticks = element_blank()) +
labs(title = "Population Percentage Changes by Census Tract in San Antonio (2010-2019)",
caption = "Source: US Census Bureau")
# Map
ggplot() +
geom_sf(data = pop_changes, fill = NA, color = "grey") +
geom_sf(data = low_pct_change_data, aes(fill = pct_change), color = NA) +
scale_fill_gradientn(colors = rev(brewer.pal(11, "Spectral")),
name = "Population % Changes\n(2010-2019)",
labels = scales::percent_format(scale = 1)) +
theme_minimal() +
theme(axis.text = element_blank(),
axis.title = element_blank(),
axis.ticks = element_blank()) +
labs(title = "Population Percentage Changes by Census Tract in San Antonio (2010-2019)",
caption = "Source: US Census Bureau")
# Map
ggplot() +
geom_sf(data = pop_changes, fill = NA, color = "grey") +
geom_sf(data = low_pct_change_data, aes(fill = pct_change), color = NA) +
scale_fill_gradientn(colors = rev(brewer.pal(11, "RdBu")),
name = "Population % Changes\n(2010-2019)",
labels = scales::percent_format(scale = 1)) +
theme_minimal() +
theme(axis.text = element_blank(),
axis.title = element_blank(),
axis.ticks = element_blank()) +
labs(title = "Population Percentage Changes by Census Tract in San Antonio (2010-2019)",
caption = "Source: US Census Bureau")
# Map
leaflet(data = precincts_with_results) %>%
addTiles() %>%
setView(lng = -98.4936,
lat = 29.4241,
zoom = 11) %>%
# City Council Districts
addPolygons(
data = districts,
color = 'black',
weight = 1.3,
opacity = 1,
fillColor = ~district_palette(District),
fillOpacity = 0.5,
label = ~District,
labelOptions = labelOptions(noHide = TRUE)
) %>%
addPolygons(
color = 'blue',
weight = 0.5,
opacity = 0.8,
fillColor = 'lightblue',
fillOpacity = 0.5,
popup = ~popup_text
)
### May 2023 General Election Mapping
library(sf)
library(leaflet)
library(tidyverse)
library(RColorBrewer)
# Load shapefile
precincts <- st_read('../shapefiles/Bexar_County_Voter_Precincts.shp')
getwd()
# 2024 - December
satx_dec2024 <- read.csv('/Users/jackturek/Documents/Repos/COSA-VisionZero/data/satx_dec24.csv', header = TRUE,
stringsAsFactors = FALSE)
### Data Loads
library(tidyverse)
# 2024 - December
satx_dec2024 <- read.csv('/Users/jackturek/Documents/Repos/COSA-VisionZero/data/satx_dec24.csv', header = TRUE,
stringsAsFactors = FALSE)
getwd()
setwd("/Users/jackturek/Documents/Repos/COSA-VisionZero/data")
# 2024 - December
satx_dec2024 <- read.csv('/Users/jackturek/Documents/Repos/COSA-VisionZero/data/satx_dec24.csv', header = TRUE,
stringsAsFactors = FALSE)
# 2024 - December
satx_dec2024 <- read.csv('/Users/jackturek/Documents/Repos/COSA-VisionZero/data/satx_dec24.csv', header = TRUE,
stringsAsFactors = FALSE)
# 2024 - December
getwd()
satx_dec2024 <- read.csv('satx_dec24.csv', header = TRUE,
stringsAsFactors = FALSE)
satx_dec2024 <- read.csv('/Users/jackturek/Documents/Repos/COSA-VisionZero/data/satx_dec24.csv', header = TRUE,
stringsAsFactors = FALSE)
setwd("/Users/jackturek/Documents/Repos/COSA-VisionZero")
satx_dec2024 <- read.csv('/Users/jackturek/Documents/Repos/COSA-VisionZero/data/satx_dec24.csv', header = TRUE,
stringsAsFactors = FALSE)
file.exists("/Users/jackturek/Documents/Repos/COSA-VisionZero/data/satx_dec24.csv")
satx_dec2024 <- read_csv('/Users/jackturek/Documents/Repos/COSA-VisionZero/data/satx_dec24.csv', header = TRUE,
stringsAsFactors = FALSE)
# 2024 - December
satx_dec2024 <- read_csv("data/satx_dec2024.csv")
satx_dec2024 <- pedcycle_cleaning_function(satx_dec2024)
# Function
pedcycle_cleaning_function <- function(dataframe){
# Adjust Crash Date and re-add
dataframe$Crash_Date <- lubridate::mdy(dataframe$Crash_Date)
dataframe$Crash_Month <- lubridate::month(dataframe$Crash_Date, label = TRUE, abbr = FALSE)
dataframe$Crash_Year <- lubridate::year(dataframe$Crash_Date)
# Adjust Lat/Lng and Street Num
dataframe$Latitude <- as.numeric(dataframe$Latitude)
dataframe$Longitude <- as.numeric(dataframe$Longitude)
dataframe$Street_Number <- as.numeric(dataframe$Street_Number)
# Filter for pedestrians and cyclists
dataframe <- dataframe %>%
filter(Person_Type == "3 - PEDALCYCLIST" |
Person_Type == "4 - PEDESTRIAN")
# Remove NA values
#dataframe <- dataframe[complete.cases(dataframe), ]
# Return cleaned data
return(dataframe)
}
satx_dec2024 <- pedcycle_cleaning_function(satx_dec2024)
ped_cycle_df <- rbind(satx_2013, satx_2014, satx_2015, satx_2016, satx_2017, satx_2018,
satx_2019, satx_2020, satx_2021, satx_2022, satx_2023_jan_may,
satx_2023_june, satx_2023_july, satx_2023_aug, satx_2023_sep, satx_oct2023,
satx_nov2023, satx_dec2023, satx_jan2024, satx_feb2024, satx_mar2024,
satx_apr2024, satx_may2024, satx_june2024, satx_july2024,
satx_aug2024, satx_sepoct2024, satx_nov2024, satx_dec2024)
# unique(ped_cycle$Crash_Year)
# class(mask1$Crash_Date)
###############################################################################
### New 2013 Data
satx_2013 <- read.csv("/Users/jackturek/Documents/Repos/COSA-VisionZero/data/satx_2013v3.csv", header = TRUE, stringsAsFactors = FALSE)
# Remove null values
# new_data_2013 <- new_data_2013[complete.cases(new_data_2013), 1]
# Adjust crash date and remove/add month column
satx_2013$Crash_Date <- mdy(satx_2013$Crash_Date)
satx_2013$Crash_Month <- month(satx_2013$Crash_Date)
satx_2013$Crash_Month <- month.name[satx_2013$Crash_Month]
satx_2013$Crash_Year <- year(satx_2013$Crash_Date)
satx_2013 <- satx_2013 %>%
filter(Person_Type == "3 - PEDALCYCLIST" |
Person_Type == "4 - PEDESTRIAN")
# Adjust Lat/Long & Street Number & Age
satx_2013$Latitude <- as.numeric(satx_2013$Latitude)
satx_2013$Longitude <- as.numeric(satx_2013$Longitude)
satx_2013$Street_Number <- as.numeric(satx_2013$Street_Number)
satx_2013$Person_Age <- as.numeric(satx_2013$Person_Age)
# Remove NA values
satx_2013 <- satx_2013[complete.cases(satx_2013), ]
# Function
pedcycle_cleaning_function <- function(dataframe){
# Adjust Crash Date and re-add
dataframe$Crash_Date <- lubridate::mdy(dataframe$Crash_Date)
dataframe$Crash_Month <- lubridate::month(dataframe$Crash_Date, label = TRUE, abbr = FALSE)
dataframe$Crash_Year <- lubridate::year(dataframe$Crash_Date)
# Adjust Lat/Lng and Street Num
dataframe$Latitude <- as.numeric(dataframe$Latitude)
dataframe$Longitude <- as.numeric(dataframe$Longitude)
dataframe$Street_Number <- as.numeric(dataframe$Street_Number)
# Filter for pedestrians and cyclists
dataframe <- dataframe %>%
filter(Person_Type == "3 - PEDALCYCLIST" |
Person_Type == "4 - PEDESTRIAN")
# Remove NA values
#dataframe <- dataframe[complete.cases(dataframe), ]
# Return cleaned data
return(dataframe)
}
# New 2014 data with function
satx_2014 <- read.csv("/Users/jackturek/Documents/Repos/COSA-VisionZero/data/satx_2014v3.csv", header = TRUE,
stringsAsFactors = FALSE)
satx_2014 <- pedcycle_cleaning_function(satx_2014)
# 2015 data load
satx_2015pt1 <- read.csv("/Users/jackturek/Documents/Repos/COSA-VisionZero/data/satx_2015v3pt1.csv", header = TRUE,
stringsAsFactors = FALSE)
satx_2015pt2 <- read.csv("/Users/jackturek/Documents/Repos/COSA-VisionZero/data/satx_2015v3pt2.csv", header = TRUE,
stringsAsFactors = FALSE)
satx_2015 <- rbind(satx_2015pt1, satx_2015pt2)
satx_2015 <- pedcycle_cleaning_function(satx_2015)
# 2016 Data Load
satx_2016pt1 <- read.csv("/Users/jackturek/Documents/Repos/COSA-VisionZero/data/satx_2016v3pt1.csv", header = TRUE,
stringsAsFactors = FALSE)
satx_2016pt2 <- read.csv("/Users/jackturek/Documents/Repos/COSA-VisionZero/data/satx_2016v3pt2.csv", header = TRUE,
stringsAsFactors = FALSE)
satx_2016 <- rbind(satx_2016pt1, satx_2016pt2)
satx_2016 <- pedcycle_cleaning_function(satx_2016)
# 2017 Data Load
satx_2017pt1 <- read.csv("/Users/jackturek/Documents/Repos/COSA-VisionZero/data/satx_2017v3pt1.csv", header = TRUE,
stringsAsFactors = FALSE)
satx_2017pt2 <- read.csv("/Users/jackturek/Documents/Repos/COSA-VisionZero/data/satx_2017v3pt2.csv", header = TRUE,
stringsAsFactors = FALSE)
satx_2017 <- rbind(satx_2017pt1, satx_2017pt2)
satx_2017 <- pedcycle_cleaning_function(satx_2017)
# 2018 Data Load
satx_2018pt1 <- read.csv("/Users/jackturek/Documents/Repos/COSA-VisionZero/data/satx_2018v3pt1.csv", header = TRUE,
stringsAsFactors = FALSE)
satx_2018pt2 <- read.csv("/Users/jackturek/Documents/Repos/COSA-VisionZero/data/satx_2018v3pt2.csv", header = TRUE,
stringsAsFactors = FALSE)
satx_2018 <- rbind(satx_2018pt1, satx_2018pt2)
satx_2018 <- pedcycle_cleaning_function(satx_2018)
# 2019 Data Load
satx_2019pt1 <- read.csv("/Users/jackturek/Documents/Repos/COSA-VisionZero/data/satx_2019v3pt1.csv", header = TRUE,
stringsAsFactors = FALSE)
satx_2019pt2 <- read.csv("/Users/jackturek/Documents/Repos/COSA-VisionZero/data/satx_2019v3pt2.csv", header = TRUE,
stringsAsFactors = FALSE)
satx_2019 <- rbind(satx_2019pt1, satx_2019pt2)
satx_2019 <- pedcycle_cleaning_function(satx_2019)
# 2020 Data Load
satx_2020 <- read.csv("/Users/jackturek/Documents/Repos/COSA-VisionZero/data/satx_2020v3.csv", header = TRUE,
stringsAsFactors = FALSE)
satx_2020 <- pedcycle_cleaning_function(satx_2020)
# 2021 Data Load
satx_2021 <- read.csv("/Users/jackturek/Documents/Repos/COSA-VisionZero/data/satx_2021v3.csv", header = TRUE,
stringsAsFactors = FALSE)
View(satx_2021)
satx_2021 <- pedcycle_cleaning_function(satx_2021)
# 2022 Data Load
satx_2022 <- read.csv("/Users/jackturek/Documents/Repos/COSA-VisionZero/data/satx_2022v3.csv", header = TRUE,
stringsAsFactors = FALSE)
satx_2022 <- pedcycle_cleaning_function(satx_2022)
# 2023 Data Load January - May
satx_2023_jan_may <- read.csv("/Users/jackturek/Documents/Repos/COSA-VisionZero/data/satx_2023_JanMay.csv", header = TRUE,
stringsAsFactors = FALSE)
satx_2023_jan_may <- pedcycle_cleaning_function(satx_2023_jan_may)
# 2023 June
satx_2023_june <- read.csv("/Users/jackturek/Documents/Repos/COSA-VisionZero/data/satx_june_2023.csv", header = TRUE,
stringsAsFactors = FALSE)
satx_2023_june <- pedcycle_cleaning_function(satx_2023_june)
# 2023 July
satx_2023_july <- read.csv("/Users/jackturek/Documents/Repos/COSA-VisionZero/data/satx_july_2023.csv", header = TRUE,
stringsAsFactors = FALSE)
satx_2023_july <- pedcycle_cleaning_function(satx_2023_july)
# 2023 August
satx_2023_aug <- read.csv("/Users/jackturek/Documents/Repos/COSA-VisionZero/data/satx_aug_2023.csv", header = TRUE,
stringsAsFactors = FALSE)
View(satx_2023_aug)
satx_2023_aug <- pedcycle_cleaning_function(satx_2023_aug)
# 2023 September
satx_2023_sep <- read.csv("/Users/jackturek/Documents/Repos/COSA-VisionZero/data/satx_sep_2023.csv", header = TRUE,
stringsAsFactors = FALSE)
satx_2023_sep <- pedcycle_cleaning_function(satx_2023_sep)
# 2023 October
satx_oct2023 <- read.csv("/Users/jackturek/Documents/Repos/COSA-VisionZero/data/satx_oct2023.csv", header = TRUE,
stringsAsFactors = FALSE)
satx_oct2023 <- pedcycle_cleaning_function(satx_oct2023)
# 2023 November
satx_nov2023 <- read.csv("/Users/jackturek/Documents/Repos/COSA-VisionZero/data/satx_nov_2023.csv", header = TRUE,
stringsAsFactors = FALSE)
satx_nov2023 <- pedcycle_cleaning_function(satx_nov2023)
# 2023 December
satx_dec2023 <- read.csv("/Users/jackturek/Documents/Repos/COSA-VisionZero/data/satx_dec_2023.csv", header = TRUE,
stringsAsFactors = FALSE)
satx_dec2023 <- pedcycle_cleaning_function(satx_dec2023)
# 2024 - January
satx_january2024 <- read.csv("/Users/jackturek/Documents/Repos/COSA-VisionZero/data/satx_jan2024.csv", header = TRUE,
stringsAsFactors = FALSE)
satx_jan2024 <- pedcycle_cleaning_function(satx_january2024)
# 2024 - February
satx_feb2024 <- read.csv("/Users/jackturek/Documents/Repos/COSA-VisionZero/data/satx_feb2024.csv", header = TRUE,
stringsAsFactors = FALSE)
satx_feb2024 <- pedcycle_cleaning_function(satx_feb2024)
# 2024 - March
satx_mar2024 <- read.csv("/Users/jackturek/Documents/Repos/COSA-VisionZero/data/satx_mar_2024.csv", header = TRUE,
stringsAsFactors = FALSE)
satx_mar2024 <- pedcycle_cleaning_function(satx_mar2024)
# 2024 - April
satx_apr2024 <- read.csv("/Users/jackturek/Documents/Repos/COSA-VisionZero/data/satx_apr_2024.csv", header = TRUE,
stringsAsFactors = FALSE)
satx_apr2024 <- pedcycle_cleaning_function(satx_apr2024)
# 2024 - May
satx_may2024 <- read.csv("/Users/jackturek/Documents/Repos/COSA-VisionZero/data/satx_may_2024.csv", header = TRUE,
stringsAsFactors = FALSE)
satx_may2024 <- pedcycle_cleaning_function(satx_may2024)
# 2024 - June
data <- read.csv("/Users/jackturek/Documents/Repos/COSA-VisionZero/data/satx_june_2024.csv", header = TRUE,
stringsAsFactors = FALSE)
satx_june2024 <- pedcycle_cleaning_function(data)
# 2024 - July
data <- read.csv("/Users/jackturek/Documents/Repos/COSA-VisionZero/data/satx_july_2024.csv", header = TRUE,
stringsAsFactors = FALSE)
satx_july2024 <- pedcycle_cleaning_function(data)
# 2024 - August
satx_aug2024 <- read.csv('/Users/jackturek/Documents/Repos/COSA-VisionZero/data/satx_aug_2024.csv', header = TRUE,
stringsAsFactors = FALSE)
satx_aug2024 <- pedcycle_cleaning_function(satx_aug2024)
# 2024 - September & October
satx_sepoct2024 <- read.csv('/Users/jackturek/Documents/Repos/COSA-VisionZero/data/satx_sepoct2024.csv', header=TRUE,
stringsAsFactors = FALSE)
satx_sepoct2024 <- pedcycle_cleaning_function(satx_sepoct2024)
# 2024 - November
satx_nov2024 <- read.csv('/Users/jackturek/Documents/Repos/COSA-VisionZero/data/satx_novr24.csv', header = TRUE,
stringsAsFactors = FALSE)
satx_nov2024 <- pedcycle_cleaning_function(satx_nov2024)
# 2024 - December
satx_dec2024 <- read_csv("data/satx_dec2024.csv")
satx_dec2024 <- pedcycle_cleaning_function(satx_dec2024)
ped_cycle_df <- rbind(satx_2013, satx_2014, satx_2015, satx_2016, satx_2017, satx_2018,
satx_2019, satx_2020, satx_2021, satx_2022, satx_2023_jan_may,
satx_2023_june, satx_2023_july, satx_2023_aug, satx_2023_sep, satx_oct2023,
satx_nov2023, satx_dec2023, satx_jan2024, satx_feb2024, satx_mar2024,
satx_apr2024, satx_may2024, satx_june2024, satx_july2024,
satx_aug2024, satx_sepoct2024, satx_nov2024, satx_dec2024)
# 2024 - December
satx_dec2024 <- read.csv("data/satx_dec2024.csv", header = TRUE, stringsAsFactors = FALSE)
satx_dec2024 <- pedcycle_cleaning_function(satx_dec2024)
ped_cycle_df <- rbind(satx_2013, satx_2014, satx_2015, satx_2016, satx_2017, satx_2018,
satx_2019, satx_2020, satx_2021, satx_2022, satx_2023_jan_may,
satx_2023_june, satx_2023_july, satx_2023_aug, satx_2023_sep, satx_oct2023,
satx_nov2023, satx_dec2023, satx_jan2024, satx_feb2024, satx_mar2024,
satx_apr2024, satx_may2024, satx_june2024, satx_july2024,
satx_aug2024, satx_sepoct2024, satx_nov2024, satx_dec2024)
## Write final df to csv
output_dir <- '/Users/jackturek/Documents/Repos/COSA-VisionZero/data/'
file_name <- 'ped_cycle_df.csv'
file_path <- file.path(output_dir, file_name)
write.csv(ped_cycle_df, file_path, row.names = FALSE)
library(shiny); runApp('src/Mappingv3.R')