The 2020 Endorsement Primary 1

Overview:

Which Democratic candidates are receiving the most support from prominent members of their party? Joe Biden vs. Elizabeth Warren vs. Bernie Sanders.

The endorsements are used by candidates to influence voters and other party elites; it can be seen as a way to get the popular or more acceptable. The endorsements also help securing the party’s first choice for nominations.

Here we are trying to look into kind of endorsements the top three likely candidates from the Democrats have. And also see who the high point endorser positions are going for. The high of 10 points are for endorser positions of past presidents, past vice presidents, Senate/Hour majority/minority leader, and DNC chair. And also check who NJ and NY endorser are supporting.

Dataset selected from https://data.fivethirtyeight.com/ : endorsements-2020.csv 2

Work:

  1. Loading csv from gitHub to dataframe:
theUrl <- "https://raw.githubusercontent.com/kamathvk1982/Data607-Week01/master/endorsements-2020.csv"
endorsements.df <- read.csv(theUrl, header = TRUE , sep = ',' )
  1. Summary of the Dataframe:
str(endorsements.df)
## 'data.frame':    1006 obs. of  13 variables:
##  $ date          : Factor w/ 133 levels "","2017-07-28",..: 2 3 4 5 6 7 8 9 9 9 ...
##  $ position      : Factor w/ 51 levels "attorney general",..: 35 21 38 38 25 12 12 44 23 25 ...
##  $ city          : Factor w/ 48 levels "","Albuquerque",..: 1 1 1 1 37 1 1 1 1 29 ...
##  $ state         : Factor w/ 57 levels "AK","AL","AR",..: 24 39 6 11 49 6 10 6 6 6 ...
##  $ endorser      : Factor w/ 1006 levels "A. Donald McEachin",..: 227 40 251 924 822 581 393 317 289 597 ...
##  $ endorsee      : Factor w/ 17 levels "","Amy Klobuchar",..: 9 8 8 8 10 11 3 11 11 11 ...
##  $ endorser.party: Factor w/ 5 levels "","D","I","NPP",..: 2 2 2 2 1 2 2 2 2 2 ...
##  $ source        : Factor w/ 207 levels "","http://www.politicspa.com/boyle-cartwright-and-evans-back-biden/91028/",..: 53 110 166 23 181 163 66 59 58 145 ...
##  $ order         : int  NA NA NA NA 6 NA NA 22 19 43 ...
##  $ category      : Factor w/ 12 levels "Candidates who have dropped out",..: 9 5 10 10 6 3 3 12 12 6 ...
##  $ body          : Factor w/ 6 levels "","Council","General Assembly",..: 1 1 1 1 1 1 1 1 1 1 ...
##  $ district      : int  6 NA NA NA NA NA NA NA NA NA ...
##  $ points        : int  3 8 6 6 3 1 1 2 2 3 ...
  1. Get subset of Data for the three Candidates , renaming columns, Adding new column, Replacing abbreviations in data:
top.3.dems.df <- subset(endorsements.df, grepl("Joe Biden", endorsements.df$endorsee) | grepl("Bernie Sanders", endorsements.df$endorsee) | grepl("Elizabeth Warren", endorsements.df$endorsee)  , select = c("position", "city", "state", "endorser", "endorsee", "points","endorser.party") , drop = FALSE  )

# Renaming Columns:
names(top.3.dems.df) <- c("position" = "EndorserPosition","city"="EndorserCity","state"="EndorserState","endorser"="Endorser","endorsee"="Endorsee","points"="Points", "endorser.party"="EndorserParty")

# Adding New Column to indicate as factor the year on year (YoY) Trend in profits:
top.3.dems.df$HighPointPosition = factor(ifelse(top.3.dems.df$Points >= 8 , "Yes",(ifelse(is.null(top.3.dems.df$Points), "N/A", "No" )) ) , levels = c("Yes","No","N/A"))

# Replacing abbreviations in EndorserParty:
top.3.dems.df$EndorserParty  = ifelse(top.3.dems.df$EndorserParty == 'D', "Democrats", ifelse(top.3.dems.df$EndorserParty == 'R', "Republic", "Independent"))

summary(top.3.dems.df)
##          EndorserPosition       EndorserCity EndorserState
##  representative  :58                  :130   CA     :14   
##  DNC member      :27      Atlanta     :  1   MA     :14   
##  mayor           : 7      Detroit     :  1   TX     : 9   
##  senator         : 7      Long Beach  :  1   PA     : 8   
##  attorney general: 5      Los Angeles :  1   VT     : 8   
##  former DNC chair: 3      Philadelphia:  1   IA     : 6   
##  (Other)         :30      (Other)     :  2   (Other):78   
##                      Endorser               Endorsee      Points    
##  A. Donald McEachin      :  1   Joe Biden       :78   Min.   :1.00  
##  Abby Finkenauer         :  1   Elizabeth Warren:32   1st Qu.:2.00  
##  Al Lawson               :  1   Bernie Sanders  :27   Median :3.00  
##  Alcee L. Hastings       :  1                   : 0   Mean   :2.81  
##  Alex Goff               :  1   Amy Klobuchar   : 0   3rd Qu.:3.00  
##  Alexandria Ocasio-Cortez:  1   Beto O'Rourke   : 0   Max.   :8.00  
##  (Other)                 :131   (Other)         : 0                 
##  EndorserParty      HighPointPosition
##  Length:137         Yes:  3          
##  Class :character   No :134          
##  Mode  :character   N/A:  0          
##                                      
##                                      
##                                      
## 
  1. Visualization Charts to show kind of endorsements the top three likely candidates from the Democrats have:
#Subset to get Joe Biden (JB) data:
top.3.dems.JB.df <- subset(top.3.dems.df, grepl("Joe Biden", top.3.dems.df$Endorsee), select = c("EndorserPosition", "EndorserCity", "EndorserState", "Endorser", "Endorsee", "Points","EndorserParty") , drop = FALSE)
#Aggregate to get the total by Positions:
top.3.dems.JB.df.summ <- aggregate(top.3.dems.JB.df$Points, by=list(EndorserPosition=top.3.dems.JB.df$EndorserPosition), FUN=sum)

# Pie Chart for endorsee Joe Biden: 
pie(top.3.dems.JB.df.summ$x, paste(top.3.dems.JB.df.summ$EndorserPosition, " - " ,top.3.dems.JB.df.summ$x , sep="" ), main = "Pie Chart for endorsee Joe Biden", radius=1, col = rainbow(length(top.3.dems.JB.df.summ$x)))

#Subset to get Elizabeth Warren (EW) data:
top.3.dems.EW.df <- subset(top.3.dems.df, grepl("Elizabeth Warren", top.3.dems.df$Endorsee), select = c("EndorserPosition", "EndorserCity", "EndorserState", "Endorser", "Endorsee", "Points","EndorserParty") , drop = FALSE)
#Aggregate to get the total by Positions:
top.3.dems.EW.df.summ <- aggregate(top.3.dems.EW.df$Points, by=list(EndorserPosition=top.3.dems.EW.df$EndorserPosition), FUN=sum)

# Box Plot  for endorsee Elizabeth Warren: 
barplot(top.3.dems.EW.df.summ$x,names.arg=top.3.dems.EW.df.summ$EndorserPosition,xlab="Endorser Position",ylab="Points",col="blue",main="Box Plot for endorsee Elizabeth Warren",border="red",las=2, cex.names=0.60)

#Subset to get Bernie Sanders (BS) data:
top.3.dems.BS.df <- subset(top.3.dems.df, grepl("Bernie Sanders", top.3.dems.df$Endorsee), select = c("EndorserPosition", "EndorserCity", "EndorserState", "Endorser", "Endorsee", "Points","EndorserParty") , drop = FALSE)
#Aggregate to get the total by Positions:
top.3.dems.BS.df.summ <- aggregate(top.3.dems.BS.df$Points, by=list(EndorserPosition=top.3.dems.BS.df$EndorserPosition), FUN=sum)

# Pie Chart for endorsee Bernie Sanders: 
pie(top.3.dems.BS.df.summ$x, paste(top.3.dems.BS.df.summ$EndorserPosition, " - " ,top.3.dems.BS.df.summ$x , sep="" ), main = "Pie Chart for endorsee Bernie Sanders", radius=1, col = rainbow(length(top.3.dems.BS.df.summ$x)))

  1. Who the high point endorser positions are going for:
    Answer: As can be seen from the data set below; Joe biden (out of the three) has the endorsements from the High Points Group of Endorsers. Three Governor supporting Joe.
HighPointPosition.df <- subset(top.3.dems.df, top.3.dems.df$HighPointPosition=="Yes", select = c("EndorserPosition", "EndorserCity", "EndorserState", "Endorser", "Endorsee", "Points","EndorserParty","HighPointPosition") , drop = FALSE)

HighPointPosition.df
  1. Who NJ and NY endorser are supporting:
    Answer: As can be seen from the data set below; Joe biden (out of the three) has the highest endorsements from NY and NJ states.
NyNj.df <- subset(top.3.dems.df, top.3.dems.df$EndorserState=="NY" | top.3.dems.df$EndorserState=="NJ"  , select = c("EndorserPosition", "EndorserCity", "EndorserState", "Endorser", "Endorsee", "Points","EndorserParty","HighPointPosition") , drop = FALSE)

NyNj.df

Conclusion:

If we take the endorsements data into considertion, we can make a call for the Democratic Nomination to be given to Joe Biden; He leads with 245 points and he also has the High Points Endorser support. Not to forget the support of NY endorser with Joe; given the Current President is from NY.



  1. More information on “The 2020 Endorsement Primary” can be found at https://projects.fivethirtyeight.com/2020-endorsements/democratic-primary/.

  2. endorsements-2020.csv: This file contains links to the data behind The 2020 Endorsement Primary. Original source of data https://projects.fivethirtyeight.com/endorsements-2020-data/endorsements-2020.csv.