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
gavin_newsom_data <- democratic_party_primary_polling|>filter(Candidate=="Gavin Newsom")|>mutate(Poll_Boundary = ifelse (State=="NULL","Nationwide",State))
gavin_newsom_data
## Candidate Polling Pollster Nationwide State
## 1 Gavin Newsom 11.0 Echelon Insights 1 NULL
## 2 Gavin Newsom 10.0 Morning Consult 1 NULL
## 3 Gavin Newsom 8.0 Morning Consult 1 NULL
## 4 Gavin Newsom 8.0 Echelon Insights 1 NULL
## 5 Gavin Newsom 7.0 Emerson College 1 NULL
## 6 Gavin Newsom 7.0 McLaughlin & Associates 1 NULL
## 7 Gavin Newsom 27.0 Capitol Weekly NULL California
## 8 Gavin Newsom 6.0 Echelon Insights 1 NULL
## 9 Gavin Newsom 9.0 SurveyUSA 1 NULL
## 10 Gavin Newsom 7.0 Echelon Insights 1 NULL
## 11 Gavin Newsom 5.0 Morning Consult 1 NULL
## 12 Gavin Newsom 10.0 Overton Insights 1 NULL
## 13 Gavin Newsom 4.0 Echelon Insights 1 NULL
## 14 Gavin Newsom 8.0 Data For Progress 1 NULL
## 15 Gavin Newsom 6.0 Yale Youth Poll 1 NULL
## 16 Gavin Newsom 7.0 Atlas Intel 1 NULL
## 17 Gavin Newsom 7.0 Quantus Insights 1 NULL
## 18 Gavin Newsom 7.0 YouGov/The Times 1 NULL
## 19 Gavin Newsom 4.0 McLaughlin & Associates 1 NULL
## 20 Gavin Newsom 8.0 McLaughlin & Associates 1 NULL
## 21 Gavin Newsom 7.0 McLaughlin & Associates 1 NULL
## 22 Gavin Newsom 7.0 J.L. Partners 1 NULL
## 23 Gavin Newsom 4.0 McLaughlin & Associates 1 NULL
## 24 Gavin Newsom 7.1 Atlas Intel 1 NULL
## 25 Gavin Newsom 17.2 Capitol Weekly NULL California
## 26 Gavin Newsom 7.0 YouGov/Economist 1 NULL
## 27 Gavin Newsom 12.0 Victory Insights NULL Florida
## 28 Gavin Newsom 11.0 Morning Consult 1 NULL
## 29 Gavin Newsom 8.0 McLaughlin & Associates 1 NULL
## 30 Gavin Newsom 21.0 co/efficient 1 NULL
## 31 Gavin Newsom 12.0 Emerson College 1 NULL
## 32 Gavin Newsom 5.0 Echelon Insights 1 NULL
## 33 Gavin Newsom 10.0 Overton Insights 1 NULL
## 34 Gavin Newsom 12.0 Rasmussen Reports 1 NULL
## 35 Gavin Newsom 10.0 Echelon Insights 1 NULL
## 36 Gavin Newsom 9.0 McLaughlin & Associates 1 NULL
## 37 Gavin Newsom 15.8 Atlas Intel 1 NULL
## 38 Gavin Newsom 10.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 428 Likely Voters 2024-12-11
## 7 681 NULL 2025-02-06
## 8 447 Likely Voters 2025-02-10
## 9 835 Registered Voters 2025-02-13
## 10 457 Likely Voters 2025-03-10
## 11 NA Registered Voters 2025-03-14
## 12 512 Registered Voters 2025-03-24
## 13 1014 NULL 2025-04-10
## 14 745 Likely Voters 2025-04-09
## 15 NA NULL 2025-04-01
## 16 2347 NULL 2025-04-11
## 17 1000 Registered Voters 2025-04-21
## 18 1296 NULL 2025-04-22
## 19 418 Likely Voters 2025-02-11
## 20 442 Likely Voters 2025-04-24
## 21 414 Likely Voters 2025-01-22
## 22 975 Registered Voters 2025-05-13
## 23 439 Likely Voters 2025-05-21
## 24 930 NULL 2025-05-22
## 25 1122 NULL 2025-05-30
## 26 650 Registered Voters 2025-03-30
## 27 600 NULL 2025-06-07
## 28 1000 Registered Voters 2025-06-13
## 29 434 Likely Voters 2025-06-10
## 30 1035 Likely Voters 2025-06-12
## 31 404 Registered Voters 2025-06-24
## 32 471 Likely Voters 2025-05-08
## 33 396 Registered Voters 2025-06-23
## 34 1229 Likely Voters 2025-06-25
## 35 505 Likely Voters 2025-07-10
## 36 444 Likely Voters 2025-07-09
## 37 1935 NULL 2025-07-13
## 38 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://mclaughlinonline.com/pols/wp-content/uploads/2024/12/National-December-Presentation-RELEASE-12-17-24.pdf
## 7 https://capitolweekly.net/ca-120-dems-in-a-funk-but-harris-and-newsom-could-still-shine/
## 8 http://echelonin.wpenginepowered.com/wp-content/uploads/February-2025-Voter-Omnibus-Topline-External.pdf
## 9 https://www.surveyusa.com/client/PollReport.aspx?g=677c71f7-f291-4d3e-800c-b2bb85f3a305
## 10 https://echeloninsights.com/in-the-news/march-2025-verified-voter-omnibus-2-2-2/
## 11 https://links.morningconsult.com/s/vb/1lz390XhGEbaH0JBI-kfBgI3j37keAUfilDiUXDQgYmIVQJ0MfiiXsutcRARmrW5O31nuJvpsPZkxkzeqZevGUwf7u2RIcvmy7IQFozhmy_SpgPgr5kmdsE_4c2EMoWD1etkNrKTPE939Wb_zs7LzPgZVKyFXefDShoGbg/y2DwDJIrXtRipwgN998cnZgGR1frvEEM/7
## 12 https://overtoninsights.com/wp-content/uploads/2025/04/Overton-Insights-Poll-April-2025-Crosstabs-Party-Ideology-2024-Vote-1.pdf
## 13 https://echeloninsights.com/in-the-news/april-2025-verified-voter-omnibus-2-2-2-2/
## 14 https://www.filesforprogress.org/datasets/2025/4/dfp_zeteo_d_primary_2028.pdf
## 15 https://docs.google.com/spreadsheets/d/1JhSWPVcKK6tdufsa52TeRk3JRwSsgtglVQP1ZAa8fg4/edit?gid=0#gid=0
## 16 https://cdn.atlasintel.org/e3edc86b-aac7-4ebe-9ef7-6a8346f658f6.pdf?_gl=1*1po007n*_ga*NjMxOTI2NjYxLjE3NDQ5Mjc1MzM.*_ga_W78QD5CNP1*MTc0NDkyNzUzMy4xLjAuMTc0NDkyNzUzMy4wLjAuMA
## 17 https://quantusinsights.org/f/split-nation-unready-party-the-strategic-drift-of-2025
## 18 https://d3nkl3psvxxpe9.cloudfront.net/documents/times_20250425.pdf
## 19 https://mclaughlinonline.com/pols/wp-content/uploads/2025/02/National-February-Presentation-RELEASE-02-18-25.pdf
## 20 https://mclaughlinonline.com/pols/wp-content/uploads/2025/05/National-April-Presentation-RELEASE-04-29-25.pdf
## 21 https://mclaughlinonline.com/pols/wp-content/uploads/2025/01/National-January-Presentation-RELEASE-01-28-25.pdf
## 22 https://nypost.com/2025/05/16/us-news/jd-vance-clear-favorite-to-win-the-gop-nomination-in-2028-poll/?utm_campaign=nypost&utm_medium=social&utm_source=twitter
## 23 https://mclaughlinonline.com/pols/wp-content/uploads/2025/05/National-May-Presentation-RELEASE-05-27-25.pdf
## 24 https://cdn.atlasintel.org/20c89f8f-d65e-4991-a491-388ae96986c9.pdf
## 25 https://capitolweekly.net/for-california-dems-will-the-past-be-prologue/
## 26 https://d3nkl3psvxxpe9.cloudfront.net/documents/econtoplines_S1a74K0.pdf
## 27 https://floridapolitics.com/archives/742956-excluding-undecideds-pete-buttigieg-leads-in-florida-dems-2028-poll/
## 28 https://pro.morningconsult.com/analysis/2028-democratic-primary-gavin-newsom-polling-june-2025
## 29 https://mclaughlinonline.com/pols/wp-content/uploads/2025/06/National-June-Presentation-RELEASE-6-16-25.pdf
## 30 https://coefficient.org/national-ice-protests-study/
## 31 https://emersoncollegepolling.com/june-national-poll/
## 32 https://echeloninsights.com/in-the-news/may-2025-verified-voter-omnibus-2-2-2-2-2/
## 33 https://overtoninsights.com/wp-content/uploads/2025/07/July-2025-Poll.pdf
## 34 https://www.rasmussenreports.com/public_content/politics/trump_administration_second_term/harris_2028_former_vp_still_leads_democratic_field
## 35 https://echeloninsights.com/in-the-news/july-2025-verified-voter-omnibus-2-2-2-2-2-2-2/
## 36 https://mclaughlinonline.com/pols/wp-content/uploads/2025/07/National-July-Presentation-RELEASE-07-15-25.pdf
## 37 https://atlasintel.org/poll/usa-national-2025-07-18
## 38 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 Nationwide
## 7 California
## 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 Nationwide
## 22 Nationwide
## 23 Nationwide
## 24 Nationwide
## 25 California
## 26 Nationwide
## 27 Florida
## 28 Nationwide
## 29 Nationwide
## 30 Nationwide
## 31 Nationwide
## 32 Nationwide
## 33 Nationwide
## 34 Nationwide
## 35 Nationwide
## 36 Nationwide
## 37 Nationwide
## 38 North Carolina
gavin_newsom_chart<-gavin_newsom_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="Gavin Newsom",x="Date",y="Polling (%)")
gavin_newsom_chart

gavin_newsom_summary<-gavin_newsom_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))
print(gavin_newsom_summary)
## avg_polling weighted_avg_polling standard_deviation maximum_polling
## 1 9.24 9.96 4.62 27
## minimum_polling median_polling
## 1 4 8