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
josh_shapiro_data<-democratic_party_primary_polling|>filter(Candidate=="Josh Shapiro")|>mutate(Poll_Boundary=ifelse(State=="NULL","Nationwide",State))
print(josh_shapiro_data)
##       Candidate Polling                Pollster Nationwide          State
## 1  Josh Shapiro     2.0        Echelon Insights          1           NULL
## 2  Josh Shapiro     3.0         Morning Consult          1           NULL
## 3  Josh Shapiro     5.0         Morning Consult          1           NULL
## 4  Josh Shapiro     7.0        Echelon Insights          1           NULL
## 5  Josh Shapiro     3.0         Emerson College          1           NULL
## 6  Josh Shapiro     5.0 McLaughlin & Associates          1           NULL
## 7  Josh Shapiro     6.0          Capitol Weekly       NULL     California
## 8  Josh Shapiro     3.0        Echelon Insights          1           NULL
## 9  Josh Shapiro     6.0               SurveyUSA          1           NULL
## 10 Josh Shapiro     2.0        Echelon Insights          1           NULL
## 11 Josh Shapiro     4.0         Morning Consult          1           NULL
## 12 Josh Shapiro     9.0        Overton Insights          1           NULL
## 13 Josh Shapiro     3.0        Echelon Insights          1           NULL
## 14 Josh Shapiro     5.0       Data For Progress          1           NULL
## 15 Josh Shapiro     5.0         Yale Youth Poll          1           NULL
## 16 Josh Shapiro     5.0        Quantus Insights          1           NULL
## 17 Josh Shapiro     4.0        YouGov/The Times          1           NULL
## 18 Josh Shapiro     3.0 McLaughlin & Associates          1           NULL
## 19 Josh Shapiro     4.0 McLaughlin & Associates          1           NULL
## 20 Josh Shapiro     3.0 McLaughlin & Associates          1           NULL
## 21 Josh Shapiro     7.0           J.L. Partners          1           NULL
## 22 Josh Shapiro     6.0 McLaughlin & Associates          1           NULL
## 23 Josh Shapiro     4.8             Atlas Intel          1           NULL
## 24 Josh Shapiro     6.3          Capitol Weekly       NULL     California
## 25 Josh Shapiro     3.0        Victory Insights       NULL        Florida
## 26 Josh Shapiro     2.0         Morning Consult          1           NULL
## 27 Josh Shapiro     3.0 McLaughlin & Associates          1           NULL
## 28 Josh Shapiro     3.0            co/efficient          1           NULL
## 29 Josh Shapiro     7.0         Emerson College          1           NULL
## 30 Josh Shapiro     2.0        Echelon Insights          1           NULL
## 31 Josh Shapiro     7.0        Overton Insights          1           NULL
## 32 Josh Shapiro    12.0       Rasmussen Reports          1           NULL
## 33 Josh Shapiro     4.0        Echelon Insights          1           NULL
## 34 Josh Shapiro     4.0 McLaughlin & Associates          1           NULL
## 35 Josh Shapiro     3.2             Atlas Intel          1           NULL
## 36 Josh Shapiro     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          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        1000 Registered Voters 2025-04-21
## 17        1296              NULL 2025-04-22
## 18         418     Likely Voters 2025-02-11
## 19         442     Likely Voters 2025-04-24
## 20         414     Likely Voters 2025-01-22
## 21         975 Registered Voters 2025-05-13
## 22         439     Likely Voters 2025-05-21
## 23         930              NULL 2025-05-22
## 24        1122              NULL 2025-05-30
## 25         600              NULL 2025-06-07
## 26        1000 Registered Voters 2025-06-13
## 27         434     Likely Voters 2025-06-10
## 28        1035     Likely Voters 2025-06-12
## 29         404 Registered Voters 2025-06-24
## 30         471     Likely Voters 2025-05-08
## 31         396 Registered Voters 2025-06-23
## 32        1229     Likely Voters 2025-06-25
## 33         505     Likely Voters 2025-07-10
## 34         444     Likely Voters 2025-07-09
## 35        1935              NULL 2025-07-13
## 36         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://quantusinsights.org/f/split-nation-unready-party-the-strategic-drift-of-2025
## 17                                                                                                                                                                              https://d3nkl3psvxxpe9.cloudfront.net/documents/times_20250425.pdf
## 18                                                                                                                                https://mclaughlinonline.com/pols/wp-content/uploads/2025/02/National-February-Presentation-RELEASE-02-18-25.pdf
## 19                                                                                                                                   https://mclaughlinonline.com/pols/wp-content/uploads/2025/05/National-April-Presentation-RELEASE-04-29-25.pdf
## 20                                                                                                                                 https://mclaughlinonline.com/pols/wp-content/uploads/2025/01/National-January-Presentation-RELEASE-01-28-25.pdf
## 21                                                                                  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
## 22                                                                                                                                    hhttps://mclaughlinonline.com/pols/wp-content/uploads/2025/05/National-May-Presentation-RELEASE-05-27-25.pdf
## 23                                                                                                                                                                             https://cdn.atlasintel.org/20c89f8f-d65e-4991-a491-388ae96986c9.pdf
## 24                                                                                                                                                                        https://capitolweekly.net/for-california-dems-will-the-past-be-prologue/
## 25                                                                                                                                https://floridapolitics.com/archives/742956-excluding-undecideds-pete-buttigieg-leads-in-florida-dems-2028-poll/
## 26                                                                                                                                                  https://pro.morningconsult.com/analysis/2028-democratic-primary-gavin-newsom-polling-june-2025
## 27                                                                                                                                     https://mclaughlinonline.com/pols/wp-content/uploads/2025/06/National-June-Presentation-RELEASE-6-16-25.pdf
## 28                                                                                                                                                                                            https://coefficient.org/national-ice-protests-study/
## 29                                                                                                                                                                                           https://emersoncollegepolling.com/june-national-poll/
## 30                                                                                                                                                              https://echeloninsights.com/in-the-news/may-2025-verified-voter-omnibus-2-2-2-2-2/
## 31                                                                                                                                                                       https://overtoninsights.com/wp-content/uploads/2025/07/July-2025-Poll.pdf
## 32                                                                                                    https://www.rasmussenreports.com/public_content/politics/trump_administration_second_term/harris_2028_former_vp_still_leads_democratic_field
## 33                                                                                                                                                         https://echeloninsights.com/in-the-news/july-2025-verified-voter-omnibus-2-2-2-2-2-2-2/
## 34                                                                                                                                    https://mclaughlinonline.com/pols/wp-content/uploads/2025/07/National-July-Presentation-RELEASE-07-15-25.pdf
## 35                                                                                                                                                                                             https://atlasintel.org/poll/usa-national-2025-07-18
## 36                                                                                  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     California
## 25        Florida
## 26     Nationwide
## 27     Nationwide
## 28     Nationwide
## 29     Nationwide
## 30     Nationwide
## 31     Nationwide
## 32     Nationwide
## 33     Nationwide
## 34     Nationwide
## 35     Nationwide
## 36 North Carolina
josh_shapiro_chart<-josh_shapiro_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="Josh Shapiro",x="Date",y="Polling (%)")
josh_shapiro_chart

josh_shapiro_summary<-josh_shapiro_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))
josh_shapiro_summary
##   avg_polling weighted_avg_polling standard_deviation maximum_polling
## 1        4.57                 4.51               2.15              12
##   minimum_polling median_polling
## 1               2              4