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

alexandria_ocasio_cortez_summary<-alexandria_ocasio_cortez_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(alexandria_ocasio_cortez_summary)
##   avg_polling weighted_avg_polling standard_deviation maximum_polling
## 1        8.71                 9.86               4.92              21
##   minimum_polling median_polling
## 1               1              7