forked from ElectProject/Early-Vote-2020G
-
Notifications
You must be signed in to change notification settings - Fork 0
/
NC.Rmd
804 lines (578 loc) · 31.2 KB
/
NC.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
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
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
---
title: "North Carolina Early Voting Statistics"
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(tidyverse)
library(knitr)
library(kableExtra)
library(scales)
library(DT)
library(highcharter)
state_stats <- read_csv("D:/DropBox/Dropbox/Mail_Ballots_2020/markdown/2020G_Early_Vote.csv")
NC_stats <- read_csv("D:/DropBox/Dropbox/Mail_Ballots_2020/markdown/2020G_Early_Vote_NC.csv")
NC_FIPS <- read_csv("D:/DropBox/Dropbox/Mail_Ballots_2020/markdown/NC_FIPS.csv")
# Setup
party_shell <- data.frame(Party=character(),
Count=integer(),
Percent=double(),
stringsAsFactors=FALSE)
party_shell[1,1] <- "Democrats"
party_shell[2,1] <- "Republicans"
party_shell[3,1] <- "Minor"
party_shell[4,1] <- "No Party Affiliation"
party_shell[5,1] <- "TOTAL"
party_shell_returned <- data.frame(Party=character(),
Count=integer(),
Frequency=double(),
Count2=integer(),
Rate=integer(),
stringsAsFactors=FALSE)
party_shell_returned[1,1] <- "Democrats"
party_shell_returned[2,1] <- "Republicans"
party_shell_returned[3,1] <- "Minor"
party_shell_returned[4,1] <- "No Party Affiliation"
party_shell_returned[5,1] <- "TOTAL"
race_shell <- data.frame(Race=character(),
Count=integer(),
Percent=double(),
stringsAsFactors=FALSE)
race_shell[1,1] <- "Non-Hispanic White"
race_shell[2,1] <- "Non-Hispanic Black"
race_shell[3,1] <- "Hispanic"
race_shell[4,1] <- "Non-Hispanic Asian American"
race_shell[5,1] <- "Non-Hispanic Native American"
race_shell[6,1] <- "Other/Multiple/Unknown"
race_shell[7,1] <- "TOTAL"
race_shell_returned <- data.frame(Race=character(),
Count=integer(),
Frequency=double(),
Count2=integer(),
Rate=integer(),
stringsAsFactors=FALSE)
race_shell_returned[1,1] <- "Non-Hispanic White"
race_shell_returned[2,1] <- "Non-Hispanic Black"
race_shell_returned[3,1] <- "Hispanic"
race_shell_returned[4,1] <- "Non-Hispanic Asian American"
race_shell_returned[5,1] <- "Non-Hispanic Native American"
race_shell_returned[6,1] <- "Other/Multiple/Unknown"
race_shell_returned[7,1] <- "TOTAL"
gender_shell <- data.frame(Gender=character(),
Count=integer(),
Percent=double(),
stringsAsFactors=FALSE)
gender_shell[1,1] <- "Female"
gender_shell[2,1] <- "Male"
gender_shell[3,1] <- "Unknown"
gender_shell[4,1] <- "TOTAL"
NC_gender_shell_returned <- data.frame(Race=character(),
Count=integer(),
Frequency=double(),
Count2=integer(),
Rate=integer(),
stringsAsFactors=FALSE)
NC_gender_shell_returned[1,1] <- "Female"
NC_gender_shell_returned[2,1] <- "Male"
NC_gender_shell_returned[3,1] <- "Unknown"
NC_gender_shell_returned[4,1] <- "TOTAL"
NC_age_shell <- data.frame(Age=character(),
Count=integer(),
Percent=double(),
stringsAsFactors=FALSE)
NC_age_shell[1,1] <- "18 to 25"
NC_age_shell[2,1] <- "26 to 40"
NC_age_shell[3,1] <- "41 to 65"
NC_age_shell[4,1] <- "66 and up"
NC_age_shell[5,1] <- "TOTAL"
NC_age_shell_returned <- data.frame(Race=character(),
Count=integer(),
Frequency=double(),
Count2=integer(),
Rate=integer(),
stringsAsFactors=FALSE)
NC_age_shell_returned[1,1] <- "18 to 25"
NC_age_shell_returned[2,1] <- "26 to 40"
NC_age_shell_returned[3,1] <- "41 to 65"
NC_age_shell_returned[4,1] <- "66 and up"
NC_age_shell_returned[5,1] <- "TOTAL"
Voted_shell <- data.frame(Voted=character(),
Count=integer(),
Percent=double(),
stringsAsFactors=FALSE)
Voted_shell[1,1] <- "Voted in 2016 General"
Voted_shell[2,1] <- "Did Not Vote in 2016 General"
Voted_shell[3,1] <- "TOTAL"
# North Carolina
NC_inperson_party <- party_shell
NC_inperson_party[1,2] <- state_stats[34,77]
NC_inperson_party[2,2] <- state_stats[34,78]
NC_inperson_party[3,2] <- state_stats[34,79]
NC_inperson_party[4,2] <- state_stats[34,80]
NC_inperson_party[5,2] <- state_stats[34,7]
NC_inperson_party$Percent <- 100*NC_inperson_party$Count/NC_inperson_party[5,2]
NC_voted_party <- party_shell
NC_voted_party[1,2] <- state_stats[34,77] + state_stats[34,29]
NC_voted_party[2,2] <- state_stats[34,78] + state_stats[34,30]
NC_voted_party[3,2] <- state_stats[34,79] + state_stats[34,31]
NC_voted_party[4,2] <- state_stats[34,80] + state_stats[34,32]
NC_voted_party[5,2] <- state_stats[34,7] + state_stats[34,6]
NC_voted_party$Percent <- 100*NC_voted_party$Count/NC_voted_party[5,2]
NC_req_send_party <- party_shell
NC_req_send_party[1,2] <- state_stats[34,10]
NC_req_send_party[2,2] <- state_stats[34,11]
NC_req_send_party[3,2] <- state_stats[34,12]
NC_req_send_party[4,2] <- state_stats[34,13]
NC_req_send_party[5,2] <- state_stats[34,5]
NC_req_send_party$Percent <- 100*NC_req_send_party$Count/NC_req_send_party[5,2]
NC_accept_party <- party_shell_returned
NC_accept_party[1,2] <- state_stats[34,29]
NC_accept_party[2,2] <- state_stats[34,30]
NC_accept_party[3,2] <- state_stats[34,31]
NC_accept_party[4,2] <- state_stats[34,32]
NC_accept_party[5,2] <- state_stats[34,6]
NC_accept_party[1,4] <- state_stats[34,10]
NC_accept_party[2,4] <- state_stats[34,11]
NC_accept_party[3,4] <- state_stats[34,12]
NC_accept_party[4,4] <- state_stats[34,13]
NC_accept_party[5,4] <- state_stats[34,5]
NC_accept_party$Frequency <- 100*NC_accept_party$Count/NC_accept_party[5,2]
NC_accept_party$Rate <- 100*NC_accept_party$Count/NC_accept_party$Count2
colnames(NC_accept_party) <- c("Party", "Returned Ballots", "Freq. Distribution", "Requested Ballots", "Return Rate")
NC_reject_party <- party_shell_returned
NC_reject_party[1,2] <- state_stats[34,49]
NC_reject_party[2,2] <- state_stats[34,50]
NC_reject_party[3,2] <- state_stats[34,51]
NC_reject_party[4,2] <- state_stats[34,52]
NC_reject_party[5,2] <- state_stats[34,48]
NC_reject_party[1,4] <- state_stats[34,29] + state_stats[34,49]
NC_reject_party[2,4] <- state_stats[34,30] + state_stats[34,50]
NC_reject_party[3,4] <- state_stats[34,31] + state_stats[34,51]
NC_reject_party[4,4] <- state_stats[34,32] + state_stats[34,52]
NC_reject_party[5,4] <- state_stats[34,6] + state_stats[34,48]
NC_reject_party$Frequency <- 100*NC_reject_party$Count/NC_reject_party[5,2]
NC_reject_party$Rate <- 100*NC_reject_party$Count/NC_reject_party$Count2
colnames(NC_reject_party) <- c("Party", "Rejected Ballots", "Freq. Distribution", "All Returned Ballots", "Rejection Rate")
NC_voted_race <- race_shell
NC_voted_race[1,2] <- sum(state_stats[34,33]) + sum(state_stats[34,81])
NC_voted_race[2,2] <- sum(state_stats[34,34]) + sum(state_stats[34,82])
NC_voted_race[3,2] <- sum(state_stats[34,37]) + sum(state_stats[34,85])
NC_voted_race[4,2] <- sum(state_stats[34,35]) + sum(state_stats[34,83])
NC_voted_race[5,2] <- sum(state_stats[34,36]) + sum(state_stats[34,84])
NC_voted_race[6,2] <- sum(state_stats[34,38]) + sum(state_stats[34,86])
NC_voted_race[7,2] <- sum(state_stats[34,6]) + sum(state_stats[34,7])
NC_voted_race$Percent <- 100 * NC_voted_race$Count/NC_voted_race[7,2]
NC_inperson_race <- race_shell
NC_inperson_race[1,2] <- sum(state_stats[34,81])
NC_inperson_race[2,2] <- sum(state_stats[34,82])
NC_inperson_race[3,2] <- sum(state_stats[34,85])
NC_inperson_race[4,2] <- sum(state_stats[34,83])
NC_inperson_race[5,2] <- sum(state_stats[34,84])
NC_inperson_race[6,2] <- sum(state_stats[34,86])
NC_inperson_race[7,2] <- sum(state_stats[34,7])
NC_inperson_race$Percent <- 100 * NC_inperson_race$Count/NC_inperson_race[7,2]
NC_req_send_race <- race_shell
NC_req_send_race[1,2] <- sum(state_stats[34,14])
NC_req_send_race[2,2] <- sum(state_stats[34,15])
NC_req_send_race[3,2] <- sum(state_stats[34,16])
NC_req_send_race[4,2] <- sum(state_stats[34,17])
NC_req_send_race[5,2] <- sum(state_stats[34,18])
NC_req_send_race[6,2] <- sum(state_stats[34,19])
NC_req_send_race[7,2] <- sum(state_stats[34,5])
NC_req_send_race$Percent <- 100 * NC_req_send_race$Count/NC_req_send_race[7,2]
NC_accept_race <- race_shell_returned
NC_accept_race[1,2] <- sum(state_stats[34,33])
NC_accept_race[2,2] <- sum(state_stats[34,34])
NC_accept_race[3,2] <- sum(state_stats[34,37])
NC_accept_race[4,2] <- sum(state_stats[34,35])
NC_accept_race[5,2] <- sum(state_stats[34,36])
NC_accept_race[6,2] <- sum(state_stats[34,38])
NC_accept_race[7,2] <- sum(state_stats[34,6])
NC_accept_race[1,4] <- sum(state_stats[34,14])
NC_accept_race[2,4] <- sum(state_stats[34,15])
NC_accept_race[3,4] <- sum(state_stats[34,16])
NC_accept_race[4,4] <- sum(state_stats[34,17])
NC_accept_race[5,4] <- sum(state_stats[34,18])
NC_accept_race[6,4] <- sum(state_stats[34,19])
NC_accept_race[7,4] <- sum(state_stats[34,5])
NC_accept_race$Frequency <- 100 * NC_accept_race$Count/NC_accept_race[7,2]
NC_accept_race$Rate <- 100*NC_accept_race$Count/NC_accept_race$Count2
colnames(NC_accept_race) <- c("Race/Ethnicity", "Returned Ballots", "Freq. Distribution", "Requested Ballots", "Return Rate")
NC_reject_race <- race_shell_returned
NC_reject_race[1,2] <- sum(state_stats[34,53])
NC_reject_race[2,2] <- sum(state_stats[34,54])
NC_reject_race[3,2] <- sum(state_stats[34,57])
NC_reject_race[4,2] <- sum(state_stats[34,55])
NC_reject_race[5,2] <- sum(state_stats[34,56])
NC_reject_race[6,2] <- sum(state_stats[34,58])
NC_reject_race[7,2] <- sum(state_stats[34,48])
NC_reject_race[1,4] <- sum(state_stats[34,33]) + sum(state_stats[34,53])
NC_reject_race[2,4] <- sum(state_stats[34,34]) + sum(state_stats[34,54])
NC_reject_race[3,4] <- sum(state_stats[34,37]) + sum(state_stats[34,57])
NC_reject_race[4,4] <- sum(state_stats[34,35]) + sum(state_stats[34,55])
NC_reject_race[5,4] <- sum(state_stats[34,36]) + sum(state_stats[34,56])
NC_reject_race[6,4] <- sum(state_stats[34,38]) + sum(state_stats[34,58])
NC_reject_race[7,4] <- sum(state_stats[34,6]) + sum(state_stats[34,48])
NC_reject_race$Frequency <- 100 * NC_reject_race$Count/NC_reject_race[7,2]
NC_reject_race$Rate <- 100*NC_reject_race$Count/NC_reject_race$Count2
colnames(NC_reject_race) <- c("Race/Ethnicity", "Rejected Ballots", "Freq. Distribution", "All Returned Ballots", "Rejection Rate")
NC_voted_voted <- Voted_shell
NC_voted_voted[1,2] <- sum(state_stats[34,68]) + sum(state_stats[34,97])
NC_voted_voted[2,2] <- sum(state_stats[34,69]) + sum(state_stats[34,98])
NC_voted_voted[3,2] <- sum(state_stats[34,6]) + sum(state_stats[34,7])
NC_voted_voted$Percent <- 100*NC_voted_voted$Count/NC_voted_voted[3,2]
NC_inperson_voted <- Voted_shell
NC_inperson_voted[1,2] <- sum(state_stats[34,97])
NC_inperson_voted[2,2] <- sum(state_stats[34,98])
NC_inperson_voted[3,2] <- sum(state_stats[34,7])
NC_inperson_voted$Percent <- 100*NC_inperson_voted$Count/NC_inperson_voted[3,2]
NC_accept_voted <- Voted_shell
NC_accept_voted[1,2] <- sum(state_stats[34,68])
NC_accept_voted[2,2] <- sum(state_stats[34,69])
NC_accept_voted[3,2] <- sum(state_stats[34,6])
NC_accept_voted$Percent <- 100*NC_accept_voted$Count/NC_accept_voted[3,2]
NC_req_send_gender <- gender_shell
NC_req_send_gender[1,2] <- sum(state_stats[34,21])
NC_req_send_gender[2,2] <- sum(state_stats[34,20])
NC_req_send_gender[3,2] <- sum(state_stats[34,22])
NC_req_send_gender[4,2] <- sum(state_stats[34,5])
NC_req_send_gender$Percent <- 100 * NC_req_send_gender$Count/NC_req_send_gender[4,2]
NC_accept_gender <- NC_gender_shell_returned
NC_accept_gender[1,2] <- sum(state_stats[34,39])
NC_accept_gender[2,2] <- sum(state_stats[34,40])
NC_accept_gender[3,2] <- sum(state_stats[34,41])
NC_accept_gender[4,2] <- sum(state_stats[34,6])
NC_accept_gender[1,4] <- sum(state_stats[34,21])
NC_accept_gender[2,4] <- sum(state_stats[34,20])
NC_accept_gender[3,4] <- sum(state_stats[34,22])
NC_accept_gender[4,4] <- sum(state_stats[34,5])
NC_accept_gender$Frequency <- 100 * NC_accept_gender$Count/NC_accept_gender[4,2]
NC_accept_gender$Rate <- 100*NC_accept_gender$Count/NC_accept_gender$Count2
colnames(NC_accept_gender) <- c("Gender", "Returned Ballots", "Freq. Distribution", "Requested Ballots", "Return Rate")
NC_req_send_age <- NC_age_shell
NC_req_send_age[1,2] <- sum(NC_stats$Mail.Req.Age.1825, na.rm = T)
NC_req_send_age[2,2] <- sum(NC_stats$Mail.Req.Age.2640, na.rm = T)
NC_req_send_age[3,2] <- sum(NC_stats$Mail.Req.Age.4165, na.rm = T)
NC_req_send_age[4,2] <- sum(NC_stats$Mail.Req.Age.66up, na.rm = T)
NC_req_send_age[5,2] <- sum(NC_stats$Mail.Req.Tot, na.rm = T)
NC_req_send_age$Percent <- 100 * NC_req_send_age$Count/NC_req_send_age[5,2]
NC_accept_age <- NC_age_shell_returned
NC_accept_age[1,2] <- sum(NC_stats$Mail.Rtn.Age.1825, na.rm = T)
NC_accept_age[2,2] <- sum(NC_stats$Mail.Rtn.Age.2640, na.rm = T)
NC_accept_age[3,2] <- sum(NC_stats$Mail.Rtn.Age.4165, na.rm = T)
NC_accept_age[4,2] <- sum(NC_stats$Mail.Rtn.Age.66up, na.rm = T)
NC_accept_age[5,2] <- sum(NC_stats$Mail.Rtn.Tot, na.rm = T)
NC_accept_age[1,4] <- sum(NC_stats$Mail.Req.Age.1825, na.rm = T)
NC_accept_age[2,4] <- sum(NC_stats$Mail.Req.Age.2640, na.rm = T)
NC_accept_age[3,4] <- sum(NC_stats$Mail.Req.Age.4165, na.rm = T)
NC_accept_age[4,4] <- sum(NC_stats$Mail.Req.Age.66up, na.rm = T)
NC_accept_age[5,4] <- sum(NC_stats$Mail.Req.Tot, na.rm = T)
NC_accept_age$Frequency <- 100 * NC_accept_age$Count/NC_accept_age[5,2]
NC_accept_age$Rate <- 100*NC_accept_age$Count/NC_accept_age$Count2
colnames(NC_accept_age) <- c("Age", "Returned Ballots", "Freq. Distribution", "Requested Ballots", "Return Rate")
NC_out_party <- party_shell_returned
NC_out_party[1,2] <- state_stats[34,10] - state_stats[34,29]
NC_out_party[2,2] <- state_stats[34,11] - state_stats[34,30]
NC_out_party[3,2] <- state_stats[34,12] - state_stats[34,31]
NC_out_party[4,2] <- state_stats[34,13] - state_stats[34,32]
NC_out_party[5,2] <- state_stats[34,5] - state_stats[34,6]
NC_out_party[1,4] <- state_stats[34,29]
NC_out_party[2,4] <- state_stats[34,30]
NC_out_party[3,4] <- state_stats[34,31]
NC_out_party[4,4] <- state_stats[34,32]
NC_out_party[5,4] <- state_stats[34,6]
NC_out_party[1,5] <- state_stats[34,10]
NC_out_party[2,5] <- state_stats[34,11]
NC_out_party[3,5] <- state_stats[34,12]
NC_out_party[4,5] <- state_stats[34,13]
NC_out_party[5,5] <- state_stats[34,5]
NC_out_party$Frequency <- 100*NC_out_party$Count/NC_out_party[5,2]
colnames(NC_out_party) <- c("Party", "Outstanding Ballots", "Freq. Distribution", "Returned Ballots", "Requested Ballots")
NC_stats_voted <- select(NC_stats, County, Reg.Voters, Voted.Tot, Pct.Voted)
NC_stats_requests <- select(NC_stats, County, Reg.Voters, Mail.Req.Tot, Pct.Request)
NC_stats_requests_Dem <- select(NC_stats, County, Reg.Voters.Dem, Mail.Req.Dem, Pct.Request.Dem)
NC_stats_requests_Rep <- select(NC_stats, County, Reg.Voters.Rep, Mail.Req.Rep, Pct.Request.Rep)
NC_stats_requests_NPA <- select(NC_stats, County, Reg.Voters.NPA, Mail.Req.NPA, Pct.Request.NPA)
NC_stats_requests_Minor <- select(NC_stats, County, Reg.Voters.Minor, Mail.Req.Minor, Pct.Request.Minor)
NC_stats_returns <- select(NC_stats, County, Mail.Req.Tot, Mail.Rtn.Tot, Pct.Return)
NC_stats_returns_Dem <- select(NC_stats, County, Mail.Req.Dem, Mail.Rtn.Dem, Pct.Return.Dem)
NC_stats_returns_Rep <- select(NC_stats, County, Mail.Req.Rep, Mail.Rtn.Rep, Pct.Return.Rep)
NC_stats_returns_NPA <- select(NC_stats, County, Mail.Req.NPA, Mail.Rtn.NPA, Pct.Return.NPA)
NC_stats_returns_Minor <- select(NC_stats, County, Mail.Req.Minor, Mail.Rtn.Minor, Pct.Return.Minor)
NC_stats_rejects <- select(NC_stats, County, Mail.Rtn.Tot, Mail.Reject.Tot, Pct.Reject)
NC_stats_rejects <- mutate(NC_stats_rejects, Mail.Rtn.Tot = Mail.Rtn.Tot + Mail.Reject.Tot)
NC_stats_rejects_Dem <- select(NC_stats, County, Mail.Rtn.Dem, Mail.Reject.Dem, Pct.Reject.Dem)
NC_stats_rejects_Dem <- mutate(NC_stats_rejects_Dem, Mail.Rtn.Dem = Mail.Rtn.Dem + Mail.Reject.Dem)
NC_stats_rejects_Rep <- select(NC_stats, County, Mail.Rtn.Rep, Mail.Reject.Rep, Pct.Reject.Rep)
NC_stats_rejects_Rep <- mutate(NC_stats_rejects_Rep, Mail.Rtn.Rep = Mail.Rtn.Rep + Mail.Reject.Rep)
NC_stats_rejects_NPA <- select(NC_stats, County, Mail.Rtn.NPA, Mail.Reject.NPA, Pct.Reject.NPA)
NC_stats_rejects_NPA <- mutate(NC_stats_rejects_NPA, Mail.Rtn.NPA = Mail.Rtn.NPA + Mail.Reject.NPA)
NC_stats_rejects_Minor <- select(NC_stats, County, Mail.Rtn.Minor, Mail.Reject.Minor, Pct.Reject.Minor)
NC_stats_rejects_Minor <- mutate(NC_stats_rejects_Minor, Mail.Rtn.Minor = Mail.Rtn.Minor + Mail.Reject.Minor)
NC_stats_rejects_nh_white <- select(NC_stats, County, Mail.Rtn.nh_white, Mail.Reject.nh_white, Pct.Reject.nh_white)
NC_stats_rejects_nh_white <- mutate(NC_stats_rejects_nh_white, Mail.Rtn.nh_white = Mail.Rtn.nh_white + Mail.Reject.nh_white)
NC_stats_rejects_nh_black <- select(NC_stats, County, Mail.Rtn.nh_black, Mail.Reject.nh_black, Pct.Reject.nh_black)
NC_stats_rejects_nh_black <- mutate(NC_stats_rejects_nh_black, Mail.Rtn.nh_black = Mail.Rtn.nh_black + Mail.Reject.nh_black)
NC_stats_out <- select(NC_stats, County, Mail.Req.Tot, Mail.Rtn.Tot)
NC_stats_out <- NC_stats_out %>%
mutate(Mail.Out.Tot = Mail.Req.Tot - Mail.Rtn.Tot)
NC_stats_out <- NC_stats_out[c(1,4,3,2)]
```
## {.tabset}
Last Report: `r state_stats[34,9]`
Source: `r state_stats[34,2]`
### Outstanding Mail Ballots
#### **Total Voted by Party Registration**
``` {r echo = FALSE}
kable(NC_out_party, format.args = list(big.mark = ",",
scientific = FALSE), digits = 1) %>%
kable_styling(bootstrap_options = "striped", full_width = F, position = "left")
```
``` {r echo = FALSE}
datatable(NC_stats_out, colnames = c("County", "Outstanding Mail Ballots", "Returned Mail Ballots", "Requested Mail Ballots"), rownames = F) %>%
formatRound(c('Mail.Out.Tot', 'Mail.Rtn.Tot', 'Mail.Req.Tot'), 0, mark = ",")
```
### Total Voted
Total Voted: **`r format(as.numeric(state_stats[34,8]), big.mark =",")`**
``` {r echo = FALSE}
NC_2020g_map_data <- left_join(NC_stats, NC_FIPS, by = "County")
NC_2020g_map_data$fips <- as.character(NC_2020g_map_data$FIPS_NUM)
NC_2020g_map_data <- mutate(NC_2020g_map_data, percent_returned = round(100*Pct.Voted, digits = 1))
mapfile <- download_map_data("countries/us/us-nc-all.js")
mapdata <- get_data_from_map(mapfile)
mapdata$row <- as.integer(rownames(mapdata))
NC_2020g_map_data <- left_join(NC_2020g_map_data, mapdata, by = "fips")
NC_2020g_map_data <- arrange(NC_2020g_map_data, row)
hcmap(map = "countries/us/us-nc-all", data = NC_2020g_map_data,
value = "percent_returned", name = "Percent voted", joinby = "fips") %>%
hc_title(text ="Turnout Rate (as Percentage of Registered Voters)") %>%
hc_subtitle(text = "County plots may not be shaded using the same scale")
```
``` {r echo = FALSE}
datatable(NC_stats_voted, colnames = c("County", "Registered Voters", "Total Voted", "Percent Voted"), rownames = F) %>%
formatPercentage('Pct.Voted', 1) %>%
formatRound(c('Reg.Voters','Voted.Tot'), 0, mark = ",")
```
#### **Total Voted by Party Registration**
``` {r echo = FALSE}
kable(NC_voted_party, format.args = list(big.mark = ",",
scientific = FALSE), digits = 1) %>%
kable_styling(bootstrap_options = "striped", full_width = F, position = "left")
```
#### **Total Voted by Race and Ethnicity**
``` {r echo = FALSE}
kable(NC_voted_race, format.args = list(big.mark = ",",
scientific = FALSE), digits = 1) %>%
kable_styling(bootstrap_options = "striped", full_width = F, position = "left")
```
#### **Total Voted by 2016 Vote History**
``` {r echo = FALSE}
kable(NC_voted_voted, format.args = list(big.mark = ",",
scientific = FALSE), digits = 1) %>%
kable_styling(bootstrap_options = "striped", full_width = F, position = "left")
```
### In-Person Votes
In-Person Votes: **`r format(as.numeric(state_stats[34,7]), big.mark =",")`**
#### **In-Person Votes by Party Registration**
``` {r echo = FALSE}
kable(NC_inperson_party, format.args = list(big.mark = ",",
scientific = FALSE), digits = 1) %>%
kable_styling(bootstrap_options = "striped", full_width = F, position = "left")
```
#### **In-Person Votes by Race and Ethnicity**
``` {r echo = FALSE}
kable(NC_inperson_race, format.args = list(big.mark = ",",
scientific = FALSE), digits = 1) %>%
kable_styling(bootstrap_options = "striped", full_width = F, position = "left")
```
#### **In-Person Votes by 2016 Vote History**
``` {r echo = FALSE}
kable(NC_inperson_voted, format.args = list(big.mark = ",",
scientific = FALSE), digits = 1) %>%
kable_styling(bootstrap_options = "striped", full_width = F, position = "left")
```
### Returned and Accepted Mail Ballots
Ballots Returned: **`r format(as.numeric(sum(NC_stats$Mail.Rtn.Tot, na.rm = T)), big.mark =",")`**
Return Rate: **`r paste(round(100*sum(NC_stats$Mail.Rtn.Tot, na.rm = T)/sum(NC_stats$Mail.Req.Tot, na.rm = T), digits = 1),"%", sep = "")`**
#### **Mail Ballots Returned and Accepted by Party Registration**
``` {r echo = FALSE}
kable(NC_accept_party, format.args = list(big.mark = ",",
scientific = FALSE), digits = 1) %>%
kable_styling(bootstrap_options = "striped", full_width = F, position = "left")
```
##### {.tabset .tabset-pills}
###### All
``` {r echo = FALSE}
NC_2020g_map_data <- left_join(NC_stats, NC_FIPS, by = "County")
NC_2020g_map_data$fips <- as.character(NC_2020g_map_data$FIPS_NUM)
NC_2020g_map_data <- mutate(NC_2020g_map_data, percent_returned = round(100*Pct.Return, digits = 1))
mapfile <- download_map_data("countries/us/us-nc-all.js")
mapdata <- get_data_from_map(mapfile)
mapdata$row <- as.integer(rownames(mapdata))
NC_2020g_map_data <- left_join(NC_2020g_map_data, mapdata, by = "fips")
NC_2020g_map_data <- arrange(NC_2020g_map_data, row)
hcmap(map = "countries/us/us-nc-all", data = NC_2020g_map_data,
value = "percent_returned", name = "Percent Returned", joinby = "fips") %>%
hc_title(text ="Mail Ballot Return Rates - All") %>%
hc_subtitle(text = "County plots may not be shaded using the same scale")
```
``` {r echo = FALSE}
datatable(NC_stats_returns, colnames = c("County", "Mail Ballots Requested", "Mail Ballots Returned", "Percent Returned"), rownames = F) %>%
formatPercentage('Pct.Return', 1) %>%
formatRound(c('Mail.Req.Tot','Mail.Rtn.Tot'), 0, mark = ",")
```
#### Mail Ballots Returned and Accepted by 2016 Vote History
Note: North Carolina provides only aggregate request statistics, so it is impossible to generate ballot return rates by 2016 general vote.
``` {r echo = FALSE}
kable(NC_accept_voted, format.args = list(big.mark = ",",
scientific = FALSE), digits = 1) %>%
kable_styling(bootstrap_options = "striped", full_width = F, position = "left")
```
#### Mail Ballots Returned and Accepted by Race and Ethnicity
``` {r echo = FALSE}
kable(NC_accept_race, format.args = list(big.mark = ",",
scientific = FALSE), digits = 1) %>%
kable_styling(bootstrap_options = "striped", full_width = F, position = "left")
```
#### Mail Ballots Returned and Accepted by Age
``` {r echo = FALSE}
kable(NC_accept_age, format.args = list(big.mark = ",",
scientific = FALSE), digits = 1) %>%
kable_styling(bootstrap_options = "striped", full_width = F, position = "left")
```
#### Mail Ballots Returned and Accepted by Gender
``` {r echo = FALSE}
kable(NC_accept_gender, format.args = list(big.mark = ",",
scientific = FALSE), digits = 1) %>%
kable_styling(bootstrap_options = "striped", full_width = F, position = "left")
```
### Rejected
Ballots Rejected: **`r format(as.numeric(sum(NC_stats$Mail.Reject.Tot, na.rm = T)), big.mark =",")`**
Rejection Rate: **`r paste(round(100*sum(NC_stats$Mail.Reject.Tot, na.rm = T)/(sum(NC_stats$Mail.Reject.Tot, na.rm = T)+sum(NC_stats$Mail.Rtn.Tot, na.rm = T)), digits = 1),"%", sep = "")`**
Most of these rejected ballots are for the ballot status reason of "WITNESS INFO INCOMPLETE".
North Carolina election officials are required by state law to follow up with these voters. If you are a North Carolina voter concerned about your mail ballot, you can track the status of your ballot at the [North Carolina State Board of Elections website](https://northcarolina.ballottrax.net/voter/).
In the "All" mail ballot returned statistics, I add the mail ballots that are returned and accepted with the rejected ballots. Dividing the number of rejected by this quantity yields a rejection rate.
#### **Mail Ballots Rejected by Party Registration**
``` {r echo = FALSE}
kable(NC_reject_party, format.args = list(big.mark = ",",
scientific = FALSE), digits = 1) %>%
kable_styling(bootstrap_options = "striped", full_width = F, position = "left")
```
##### {.tabset .tabset-pills}
###### All
``` {r echo = FALSE}
NC_2020g_map_data <- left_join(NC_stats, NC_FIPS, by = "County")
NC_2020g_map_data$fips <- as.character(NC_2020g_map_data$FIPS_NUM)
NC_2020g_map_data <- mutate(NC_2020g_map_data, percent_rejected = round(100*Pct.Reject, digits = 1))
mapfile <- download_map_data("countries/us/us-nc-all.js")
mapdata <- get_data_from_map(mapfile)
mapdata$row <- as.integer(rownames(mapdata))
NC_2020g_map_data <- left_join(NC_2020g_map_data, mapdata, by = "fips")
NC_2020g_map_data <- arrange(NC_2020g_map_data, row)
hcmap(map = "countries/us/us-nc-all", data = NC_2020g_map_data,
value = "percent_rejected", name = "Percent Rejected", joinby = "fips") %>%
hc_title(text ="Mail Ballot Rejection Rates - All") %>%
hc_subtitle(text = "County plots may not be shaded using the same scale")
```
``` {r echo = FALSE}
datatable(NC_stats_rejects, colnames = c("County", "All Mail Ballots Returned", "Mail Ballots Rejected", "Percent Rejected"), rownames = F) %>%
formatPercentage('Pct.Reject', 1) %>%
formatRound(c('Mail.Rtn.Tot','Mail.Reject.Tot'), 0, mark = ",")
```
#### **Mail Ballots Rejected by Race and Ethnicity**
``` {r echo = FALSE}
kable(NC_reject_race, format.args = list(big.mark = ",",
scientific = FALSE), digits = 1) %>%
kable_styling(bootstrap_options = "striped", full_width = F, position = "left")
```
##### {.tabset .tabset-pills}
###### Non-Hispanic White
``` {r echo = FALSE}
NC_2020g_map_data <- left_join(NC_stats, NC_FIPS, by = "County")
NC_2020g_map_data$fips <- as.character(NC_2020g_map_data$FIPS_NUM)
NC_2020g_map_data <- mutate(NC_2020g_map_data, percent_rejected = round(100*Pct.Reject.nh_white, digits = 1))
mapfile <- download_map_data("countries/us/us-nc-all.js")
mapdata <- get_data_from_map(mapfile)
mapdata$row <- as.integer(rownames(mapdata))
NC_2020g_map_data <- left_join(NC_2020g_map_data, mapdata, by = "fips")
NC_2020g_map_data <- arrange(NC_2020g_map_data, row)
hcmap(map = "countries/us/us-nc-all", data = NC_2020g_map_data,
value = "percent_rejected", name = "Percent Rejected", joinby = "fips") %>%
hc_title(text ="Mail Ballot Rejection Rates - Non-Hispanic White") %>%
hc_subtitle(text = "County plots may not be shaded using the same scale")
```
``` {r echo = FALSE}
datatable(NC_stats_rejects_nh_white, colnames = c("County", "All Mail Ballots Returned", "Mail Ballots Rejected", "Percent Rejected"), rownames = F) %>%
formatPercentage('Pct.Reject.nh_white', 1) %>%
formatRound(c('Mail.Rtn.nh_white','Mail.Reject.nh_white'), 0, mark = ",")
```
###### Non-Hispanic Black
``` {r echo = FALSE}
NC_2020g_map_data <- left_join(NC_stats, NC_FIPS, by = "County")
NC_2020g_map_data$fips <- as.character(NC_2020g_map_data$FIPS_NUM)
NC_2020g_map_data <- mutate(NC_2020g_map_data, percent_rejected = round(100*Pct.Reject.nh_black, digits = 1))
mapfile <- download_map_data("countries/us/us-nc-all.js")
mapdata <- get_data_from_map(mapfile)
mapdata$row <- as.integer(rownames(mapdata))
NC_2020g_map_data <- left_join(NC_2020g_map_data, mapdata, by = "fips")
NC_2020g_map_data <- arrange(NC_2020g_map_data, row)
hcmap(map = "countries/us/us-nc-all", data = NC_2020g_map_data,
value = "percent_rejected", name = "Percent Rejected", joinby = "fips") %>%
hc_title(text ="Mail Ballot Rejection Rates - Non-Hispanic Black") %>%
hc_subtitle(text = "County plots may not be shaded using the same scale")
```
``` {r echo = FALSE}
datatable(NC_stats_rejects_nh_black, colnames = c("County", "All Mail Ballots Returned", "Mail Ballots Rejected", "Percent Rejected"), rownames = F) %>%
formatPercentage('Pct.Reject.nh_black', 1) %>%
formatRound(c('Mail.Rtn.nh_black','Mail.Reject.nh_black'), 0, mark = ",")
```
### Requested
Ballots Requested: **`r format(as.numeric(sum(NC_stats$Mail.Req.Tot)), big.mark =",")`**
Request Rate: **`r paste(round(100*sum(NC_stats$Mail.Req.Tot)/(sum(NC_stats$Reg.Voters)), digits = 1),"%", sep = "")`**
#### **Mail Ballot Requests by Party Registration**
North Carolina registered Democrats have a **`r format(as.numeric(NC_req_send_party[1,2]-NC_req_send_party[2,2]), big.mark =",")`** ballot request lead over registered Republicans.
``` {r echo = FALSE}
kable(NC_req_send_party, format.args = list(big.mark = ",",
scientific = FALSE), digits = 1) %>%
kable_styling(bootstrap_options = "striped", full_width = F, position = "left")
```
##### {.tabset .tabset-pills}
North Carolina releases an update to the voter registration file each Saturday. The voter registration numbers are from the most recent release and may be slightly dated.
###### All
``` {r echo = FALSE}
NC_2020g_map_data <- left_join(NC_stats, NC_FIPS, by = "County")
NC_2020g_map_data$fips <- as.character(NC_2020g_map_data$FIPS_NUM)
NC_2020g_map_data <- mutate(NC_2020g_map_data, percent_requested = round(100*Pct.Request, digits = 1))
mapfile <- download_map_data("countries/us/us-nc-all.js")
mapdata <- get_data_from_map(mapfile)
mapdata$row <- as.integer(rownames(mapdata))
NC_2020g_map_data <- left_join(NC_2020g_map_data, mapdata, by = "fips")
NC_2020g_map_data <- arrange(NC_2020g_map_data, row)
hcmap(map = "countries/us/us-nc-all", data = NC_2020g_map_data,
value = "percent_requested", name = "Percent Requested", joinby = "fips") %>%
hc_title(text ="Mail Ballot Request Rates - All") %>%
hc_subtitle(text = "County plots may not be shaded using the same scale")
```
``` {r echo = FALSE}
datatable(NC_stats_requests, colnames = c("County", "Registered Voters", "Mail Ballot Requests", "Percent Requested"), rownames = F) %>%
formatPercentage('Pct.Request', 1) %>%
formatRound(c('Reg.Voters','Mail.Req.Tot'), 0, mark = ",")
```
#### Mail Ballot Requests by Race and Ethnicity
``` {r echo = FALSE}
kable(NC_req_send_race, format.args = list(big.mark = ",",
scientific = FALSE), digits = 1) %>%
kable_styling(bootstrap_options = "striped", full_width = F, position = "left")
```
#### Mail Ballot Requests by Age
North Carolina provides mail ballot request data in age ranges inconsistent with other states' ranges. The age statistics presented here are not included in the national age statistics.
``` {r echo = FALSE}
kable(NC_req_send_age, format.args = list(big.mark = ",",
scientific = FALSE), digits = 1) %>%
kable_styling(bootstrap_options = "striped", full_width = F, position = "left")
```
#### Mail Ballot Requests by Gender
``` {r echo = FALSE}
kable(NC_req_send_gender, format.args = list(big.mark = ",",
scientific = FALSE), digits = 1) %>%
kable_styling(bootstrap_options = "striped", full_width = F, position = "left")
```