source("Main.R")
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
## Warning in eval(ei, envir): NAs introduced by coercion
## Warning in eval(ei, envir): NAs introduced by coercion
gretchen_whitmer_data<-democratic_party_primary_polling|>filter(Candidate=="Gretchen Whitmer")|>mutate(Poll_Boundary=ifelse(State=="NULL","Nationwide",State))
print(gretchen_whitmer_data)
## Candidate Polling Pollster Nationwide State
## 1 Gretchen Whitmer 3.0 Echelon Insights 1 NULL
## 2 Gretchen Whitmer 4.0 Morning Consult 1 NULL
## 3 Gretchen Whitmer 3.0 Morning Consult 1 NULL
## 4 Gretchen Whitmer 3.0 Echelon Insights 1 NULL
## 5 Gretchen Whitmer 3.0 Emerson College 1 NULL
## 6 Gretchen Whitmer 6.0 Capitol Weekly NULL California
## 7 Gretchen Whitmer 4.0 Echelon Insights 1 NULL
## 8 Gretchen Whitmer 4.0 SurveyUSA 1 NULL
## 9 Gretchen Whitmer 2.0 Echelon Insights 1 NULL
## 10 Gretchen Whitmer 2.0 Morning Consult 1 NULL
## 11 Gretchen Whitmer 6.0 Overton Insights 1 NULL
## 12 Gretchen Whitmer 4.0 Data For Progress 1 NULL
## 13 Gretchen Whitmer 3.0 Yale Youth Poll 1 NULL
## 14 Gretchen Whitmer 9.0 Atlas Intel 1 NULL
## 15 Gretchen Whitmer 1.0 YouGov/The Times 1 NULL
## 16 Gretchen Whitmer 4.0 McLaughlin & Associates 1 NULL
## 17 Gretchen Whitmer 2.0 McLaughlin & Associates 1 NULL
## 18 Gretchen Whitmer 3.0 McLaughlin & Associates 1 NULL
## 19 Gretchen Whitmer 3.0 McLaughlin & Associates 1 NULL
## 20 Gretchen Whitmer 3.7 Atlas Intel 1 NULL
## 21 Gretchen Whitmer 5.5 Capitol Weekly NULL California
## 22 Gretchen Whitmer 2.0 YouGov/Economist 1 NULL
## 23 Gretchen Whitmer 2.0 Morning Consult 1 NULL
## 24 Gretchen Whitmer 3.0 McLaughlin & Associates 1 NULL
## 25 Gretchen Whitmer 3.0 Emerson College 1 NULL
## 26 Gretchen Whitmer 2.0 Echelon Insights 1 NULL
## 27 Gretchen Whitmer 3.0 McLaughlin & Associates 1 NULL
## 28 Gretchen Whitmer 5.0 Overton Insights 1 NULL
## 29 Gretchen Whitmer 3.0 Echelon Insights 1 NULL
## 30 Gretchen Whitmer 4.0 McLaughlin & Associates 1 NULL
## 31 Gretchen Whitmer 1.4 Atlas Intel 1 NULL
## 32 Gretchen Whitmer 3.2 Emerson College NULL North Carolina
## Sample_Size Voter_Type DMY
## 1 499 Registered Voters 2024-01-16
## 2 3997 Registered Voters 2024-05-28
## 3 1012 Registered Voters 2024-11-15
## 4 457 Likely Voters 2024-11-14
## 5 400 Registered Voters 2024-11-20
## 6 681 NULL 2025-02-06
## 7 447 Likely Voters 2025-02-10
## 8 835 Registered Voters 2025-02-13
## 9 457 Likely Voters 2025-03-10
## 10 NA Registered Voters 2025-03-14
## 11 512 Registered Voters 2025-03-24
## 12 745 Likely Voters 2025-04-09
## 13 NA NULL 2025-04-01
## 14 2347 NULL 2025-04-11
## 15 1296 NULL 2025-04-22
## 16 418 Likely Voters 2025-02-11
## 17 442 Likely Voters 2025-04-24
## 18 414 Likely Voters 2025-01-22
## 19 439 Likely Voters 2025-05-21
## 20 930 NULL 2025-05-22
## 21 1122 NULL 2025-05-30
## 22 650 Registered Voters 2025-03-30
## 23 1000 Registered Voters 2025-06-13
## 24 434 Likely Voters 2025-06-10
## 25 404 Registered Voters 2025-06-24
## 26 471 Likely Voters 2025-05-08
## 27 428 Likely Voters 2024-12-11
## 28 396 Registered Voters 2025-06-23
## 29 505 Likely Voters 2025-07-10
## 30 444 Likely Voters 2025-07-09
## 31 1935 NULL 2025-07-13
## 32 445 Likely Voters 2025-07-28
## Link
## 1 https://x.com/Politics_Polls/status/1749632663122505993?s=20
## 2 https://www.politico.com/f/?id=0000018f-f8f8-d844-a1ff-fffed00f0000
## 3 https://pro.morningconsult.com/analysis/kamala-harris-2028-democratic-primary-polling-november-2024
## 4 https://echeloninsights.com/in-the-news/nov-2024-verified-voter-omnibus/
## 5 https://emersoncollegepolling.com/november-2024-national-poll-trump-favorability-jumps-post-election-2028-election-kicks-off-with-harris-and-vance-leading-primaries/
## 6 https://capitolweekly.net/ca-120-dems-in-a-funk-but-harris-and-newsom-could-still-shine/
## 7 http://echelonin.wpenginepowered.com/wp-content/uploads/February-2025-Voter-Omnibus-Topline-External.pdf
## 8 https://www.surveyusa.com/client/PollReport.aspx?g=677c71f7-f291-4d3e-800c-b2bb85f3a305
## 9 https://echeloninsights.com/in-the-news/march-2025-verified-voter-omnibus-2-2-2/
## 10 https://links.morningconsult.com/s/vb/1lz390XhGEbaH0JBI-kfBgI3j37keAUfilDiUXDQgYmIVQJ0MfiiXsutcRARmrW5O31nuJvpsPZkxkzeqZevGUwf7u2RIcvmy7IQFozhmy_SpgPgr5kmdsE_4c2EMoWD1etkNrKTPE939Wb_zs7LzPgZVKyFXefDShoGbg/y2DwDJIrXtRipwgN998cnZgGR1frvEEM/7
## 11 https://overtoninsights.com/wp-content/uploads/2025/04/Overton-Insights-Poll-April-2025-Crosstabs-Party-Ideology-2024-Vote-1.pdf
## 12 https://www.filesforprogress.org/datasets/2025/4/dfp_zeteo_d_primary_2028.pdf
## 13 https://docs.google.com/spreadsheets/d/1JhSWPVcKK6tdufsa52TeRk3JRwSsgtglVQP1ZAa8fg4/edit?gid=0#gid=0
## 14 https://cdn.atlasintel.org/e3edc86b-aac7-4ebe-9ef7-6a8346f658f6.pdf?_gl=1*1po007n*_ga*NjMxOTI2NjYxLjE3NDQ5Mjc1MzM.*_ga_W78QD5CNP1*MTc0NDkyNzUzMy4xLjAuMTc0NDkyNzUzMy4wLjAuMA
## 15 https://d3nkl3psvxxpe9.cloudfront.net/documents/times_20250425.pdf
## 16 https://mclaughlinonline.com/pols/wp-content/uploads/2025/02/National-February-Presentation-RELEASE-02-18-25.pdf
## 17 https://mclaughlinonline.com/pols/wp-content/uploads/2025/05/National-April-Presentation-RELEASE-04-29-25.pdf
## 18 https://mclaughlinonline.com/pols/wp-content/uploads/2025/01/National-January-Presentation-RELEASE-01-28-25.pdf
## 19 https://mclaughlinonline.com/pols/wp-content/uploads/2025/05/National-May-Presentation-RELEASE-05-27-25.pdf
## 20 https://cdn.atlasintel.org/20c89f8f-d65e-4991-a491-388ae96986c9.pdf
## 21 https://capitolweekly.net/for-california-dems-will-the-past-be-prologue/
## 22 https://d3nkl3psvxxpe9.cloudfront.net/documents/econtoplines_S1a74K0.pdf
## 23 https://pro.morningconsult.com/analysis/2028-democratic-primary-gavin-newsom-polling-june-2025
## 24 https://mclaughlinonline.com/pols/wp-content/uploads/2025/06/National-June-Presentation-RELEASE-6-16-25.pdf
## 25 https://emersoncollegepolling.com/june-national-poll/
## 26 https://echeloninsights.com/in-the-news/may-2025-verified-voter-omnibus-2-2-2-2-2/
## 27 https://mclaughlinonline.com/pols/wp-content/uploads/2024/12/National-December-Presentation-RELEASE-12-17-24.pdf
## 28 https://overtoninsights.com/wp-content/uploads/2025/07/July-2025-Poll.pdf
## 29 https://echeloninsights.com/in-the-news/july-2025-verified-voter-omnibus-2-2-2-2-2-2-2/
## 30 https://mclaughlinonline.com/pols/wp-content/uploads/2025/07/National-July-Presentation-RELEASE-07-15-25.pdf
## 31 https://atlasintel.org/poll/usa-national-2025-07-18
## 32 https://emersoncollegepolling.com/north-carolina-2026-poll-cooper-starts-us-senate-race-with-six-point-lead-and-clear-name-recognition-advantage-over-whatley/
## Poll_Boundary
## 1 Nationwide
## 2 Nationwide
## 3 Nationwide
## 4 Nationwide
## 5 Nationwide
## 6 California
## 7 Nationwide
## 8 Nationwide
## 9 Nationwide
## 10 Nationwide
## 11 Nationwide
## 12 Nationwide
## 13 Nationwide
## 14 Nationwide
## 15 Nationwide
## 16 Nationwide
## 17 Nationwide
## 18 Nationwide
## 19 Nationwide
## 20 Nationwide
## 21 California
## 22 Nationwide
## 23 Nationwide
## 24 Nationwide
## 25 Nationwide
## 26 Nationwide
## 27 Nationwide
## 28 Nationwide
## 29 Nationwide
## 30 Nationwide
## 31 Nationwide
## 32 North Carolina
gretchen_whitmer_chart<-gretchen_whitmer_data|>ggplot(aes(x=DMY,y=Polling,color=Poll_Boundary))+geom_point(alpha=0.6)+ theme_gray(base_size=14)+geom_line()+scale_x_date(date_breaks = "3 months")+labs(title="Gretchen Whitmer",x="Date",y="Polling (%)")
gretchen_whitmer_chart

gretchen_whitmer_summary<-gretchen_whitmer_data|>summarise(avg_polling=round(mean(Polling),digits=2),weighted_avg_polling=round(sum(Polling*Sample_Size/(sum(Sample_Size,na.rm=TRUE)),na.rm=TRUE),digits=2),
standard_deviation=round(sd(Polling),digits=2),maximum_polling=max(Polling),minimum_polling=min(Polling),median_polling=median(Polling))
gretchen_whitmer_summary
## avg_polling weighted_avg_polling standard_deviation maximum_polling
## 1 3.43 3.82 1.58 9
## minimum_polling median_polling
## 1 1 3