Hazal Gunduz

#Presidential Approval Polls

#An approval rating is a percentage determined by polling which indicates the percentage of respondents to an opinion poll who approve of a particular person or program. Typically, an approval rating is given to a politician based on responses to a poll in which a sample of people are asked whether they approve or disapprove of that particular political figure. The question could been ask: Do you approve or disapprove of the way that the current president can handling their job as president?

#Sometimes, pollsters release numbers for the president’s approval rating among different populations — for example, all adults, registered voters, likely voters. In this case, we default to the result that represents the broadest swath of people — so adults over registered voters, registered voters over likely voters.

president_approval_polls<-read.csv("https://projects.fivethirtyeight.com/polls-page/data/president_approval_polls.csv")
president_approval_polls<-data.frame(president_approval_polls)
dim(president_approval_polls)
## [1] 829  28
head(president_approval_polls)
##   question_id poll_id state politician_id          politician pollster_id
## 1      144551   75790    NA            42 Joseph R. Biden Jr.        1575
## 2      144553   75791    NA            42 Joseph R. Biden Jr.         399
## 3      144545   75787    NA            42 Joseph R. Biden Jr.        1189
## 4      144540   75785    NA            42 Joseph R. Biden Jr.         399
## 5      144606   75817    NA            42 Joseph R. Biden Jr.        1189
## 6      144526   75779    NA            42 Joseph R. Biden Jr.         241
##                             pollster sponsor_ids           sponsors
## 1                              Léger        1436 The Canadian Press
## 2 Rasmussen (Pulse Opinion Research)        1640         The ANTIFA
## 3                    Morning Consult                               
## 4 Rasmussen (Pulse Opinion Research)        1640         The ANTIFA
## 5                    Morning Consult                               
## 6                              Ipsos          71            Reuters
##                               display_name pollster_rating_id
## 1                                    Léger                572
## 2 Rasmussen Reports/Pulse Opinion Research                277
## 3                          Morning Consult                218
## 4 Rasmussen Reports/Pulse Opinion Research                277
## 5                          Morning Consult                218
## 6                                    Ipsos                154
##                       pollster_rating_name fte_grade sample_size population
## 1                                    Léger       B/C        1004          a
## 2 Rasmussen Reports/Pulse Opinion Research         B        1500         lv
## 3                          Morning Consult         B       15623         rv
## 4 Rasmussen Reports/Pulse Opinion Research         B        1500         lv
## 5                          Morning Consult         B        2200          a
## 6                                    Ipsos        B-        1006          a
##   population_full methodology start_date end_date sponsor_candidate tracking
## 1               a      Online    8/27/21  8/30/21                NA       NA
## 2              lv  IVR/Online    8/26/21  8/30/21                NA     TRUE
## 3              rv      Online    8/27/21  8/29/21                NA     TRUE
## 4              lv  IVR/Online    8/25/21  8/29/21                NA     TRUE
## 5               a      Online    8/24/21  8/29/21                NA       NA
## 6               a      Online    8/25/21  8/26/21                NA       NA
##      created_at notes
## 1 8/31/21 09:21      
## 2 8/31/21 10:03      
## 3 8/30/21 17:15      
## 4 8/30/21 11:07      
## 5 8/31/21 21:03      
## 6 8/26/21 20:25      
##                                                                                                                                                                           url
## 1                           https://2g2ckk18vixp3neolz4b6605-wpengine.netdna-ssl.com/wp-content/uploads/2021/08/Legers-North-American-Tracker-August-30th-2021-compressed.pdf
## 2                                                                  https://www.rasmussenreports.com/public_content/politics/biden_administration/biden_approval_index_history
## 3                                                                                                https://morningconsult.com/2021/08/30/joe-biden-approval-rating-afghanistan/
## 4                                                                  https://www.rasmussenreports.com/public_content/politics/biden_administration/biden_approval_index_history
## 5                                                                    https://assets.morningconsult.com/wp-uploads/2021/08/31163040/2108136_crosstabs_FDAAPPROVAL_Adults-1.pdf
## 6 https://www.ipsos.com/sites/default/files/ct/news/documents/2021-08/2021%20Ipsos%20Tracking%20-%20Core%20Political%20Presidential%20Approval%20Tracker%2008%2026%202021.pdf
##   source yes no alternate_answers
## 1    538  48 49                 2
## 2    538  44 54                 0
## 3    538  48 49                 3
## 4    538  45 54                 0
## 5    538  48 45                 0
## 6    538  49 46                 0
president_approval_polls<-data.frame(president_approval_polls)
summary(president_approval_polls)
##   question_id        poll_id       state         politician_id
##  Min.   :139394   Min.   :74246   Mode:logical   Min.   :42   
##  1st Qu.:140261   1st Qu.:74523   NA's:829       1st Qu.:42   
##  Median :142305   Median :74788                  Median :42   
##  Mean   :141833   Mean   :74865                  Mean   :42   
##  3rd Qu.:143115   3rd Qu.:75063                  3rd Qu.:42   
##  Max.   :144606   Max.   :75817                  Max.   :42   
##                                                               
##   politician         pollster_id     pollster         sponsor_ids       
##  Length:829         Min.   :  11   Length:829         Length:829        
##  Class :character   1st Qu.: 399   Class :character   Class :character  
##  Mode  :character   Median :1189   Mode  :character   Mode  :character  
##                     Mean   : 884                                        
##                     3rd Qu.:1189                                        
##                     Max.   :1690                                        
##                                                                         
##    sponsors         display_name       pollster_rating_id pollster_rating_name
##  Length:829         Length:829         Min.   :  3.0      Length:829          
##  Class :character   Class :character   1st Qu.:218.0      Class :character    
##  Mode  :character   Mode  :character   Median :218.0      Mode  :character    
##                                        Mean   :258.8                          
##                                        3rd Qu.:277.0                          
##                                        Max.   :688.0                          
##                                                                               
##   fte_grade          sample_size     population        population_full   
##  Length:829         Min.   :  515   Length:829         Length:829        
##  Class :character   1st Qu.: 1242   Class :character   Class :character  
##  Mode  :character   Median : 1500   Mode  :character   Mode  :character  
##                     Mean   : 5205                                        
##                     3rd Qu.:15000                                        
##                     Max.   :22000                                        
##                     NA's   :7                                            
##  methodology         start_date          end_date         sponsor_candidate
##  Length:829         Length:829         Length:829         Mode:logical     
##  Class :character   Class :character   Class :character   NA's:829         
##  Mode  :character   Mode  :character   Mode  :character                    
##                                                                            
##                                                                            
##                                                                            
##                                                                            
##  tracking        created_at           notes               url           
##  Mode:logical   Length:829         Length:829         Length:829        
##  TRUE:379       Class :character   Class :character   Class :character  
##  NA's:450       Mode  :character   Mode  :character   Mode  :character  
##                                                                         
##                                                                         
##                                                                         
##                                                                         
##      source         yes             no        alternate_answers
##  Min.   :538   Min.   :40.0   Min.   :28.00   Min.   : 0.000   
##  1st Qu.:538   1st Qu.:50.0   1st Qu.:37.00   1st Qu.: 0.000   
##  Median :538   Median :53.0   Median :40.00   Median : 0.000   
##  Mean   :538   Mean   :52.8   Mean   :40.92   Mean   : 2.317   
##  3rd Qu.:538   3rd Qu.:55.0   3rd Qu.:45.00   3rd Qu.: 4.000   
##  Max.   :538   Max.   :63.0   Max.   :55.10   Max.   :26.000   
##