Assignment – Loading Data into a Data Frame

Hazal Gunduz

Assignment Requirements

Your task is to first choose one of the provided datasets on fivethirtyeight.com that you find interesting: 1.Take the data, and create one or more code blocks. You should finish with a data frame that contains a subset of the columns in your selected dataset. If there is an obvious target (aka predictor or independent) variable, you should include this in your set of columns. You should include (or add if necessary) meaningful column names and replace (if necessary) any non-intuitive abbreviations used in the data that you selected. For example, if you had instead been tasked with working with the UCI mushroom dataset, you would include the target column for edible or poisonous, and transform “e” values to “edible.” Your deliverable is the R code to perform these transformation tasks.

2.Make sure that the original data file is accessible through your code—for example, stored in a GitHub repository or AWS S3 bucket and referenced in your code. If the code references data on your local machine, then your work is not reproducible!

3.Start your R Markdown document with a two to three sentence “Overview” or “Introduction” description of what the article that you chose is about, and include a link to the article.

4.Finish with a “Conclusions” or “Findings and Recommendations” text block that includes what you might do to extend, verify, or update the work from the selected article.

5.Each of your text blocks should minimally include at least one header, and additional non-header text.

6.You’re of course welcome—but not required–to include additional information, such as exploratory data analysis graphics (which we will cover later in the course).

7.Place your solution into a single R Markdown (.Rmd) file and publish your solution out to rpubs.com.

8.Post the .Rmd file in your GitHub repository, and provide the appropriate URLs to your GitHub repository and your rpubs.com file in your assignment link.

Overview

FiveThirtyEight ( https://projects.fivethirtyeight.com/biden-approval-rating ) track the president’s approval rating in real time for President Biden. According to our average of all the Biden-approval polls we have so far, Biden starts his administration with a 53.9 percent approval rating and a 35.1 percent disapproval rating.

Data Head: How popular-unpopular is Joe Biden?

Data Title: approval_polllist

approval_polllist<-read.csv("https://projects.fivethirtyeight.com/biden-approval-data/approval_polllist.csv")
approval_polllist<-data.frame(approval_polllist)
dim(approval_polllist)
## [1] 1531   22
head(approval_polllist)
##             president  subgroup modeldate startdate   enddate
## 1 Joseph R. Biden Jr. All polls 8/30/2021 1/19/2021 1/21/2021
## 2 Joseph R. Biden Jr. All polls 8/30/2021 1/19/2021 1/21/2021
## 3 Joseph R. Biden Jr. All polls 8/30/2021 1/20/2021 1/21/2021
## 4 Joseph R. Biden Jr. All polls 8/30/2021 1/20/2021 1/21/2021
## 5 Joseph R. Biden Jr. All polls 8/30/2021 1/20/2021 1/22/2021
## 6 Joseph R. Biden Jr. All polls 8/30/2021 1/20/2021 1/21/2021
##                                   pollster grade samplesize population
## 1                          Morning Consult     B      15000          a
## 2 Rasmussen Reports/Pulse Opinion Research     B       1500         lv
## 3                                    Ipsos    B-       1115          a
## 4                          Morning Consult     B       1993         rv
## 5                          Morning Consult     B      15000          a
## 6                                   YouGov    B+       1516          a
##       weight influence approve disapprove adjusted_approve adjusted_disapprove
## 1 0.25936103         0      50         28         48.62436            31.23816
## 2 0.33818752         0      48         45         50.57782            38.62889
## 3 1.10139750         0      55         32         53.78079            32.98783
## 4 0.09297777         0      56         31         54.62436            34.23816
## 5 0.23326085         0      51         28         49.62436            31.23816
## 6 1.24540120         0      45         28         46.48311            28.37984
##   multiversions tracking
## 1                   TRUE
## 2                   TRUE
## 3                     NA
## 4                     NA
## 5                   TRUE
## 6                     NA
##                                                                                                                                                       url
## 1                                                                                                 https://morningconsult.com/form/global-leader-approval/
## 2                                              https://www.rasmussenreports.com/public_content/politics/biden_administration/biden_approval_index_history
## 3 https://www.ipsos.com/sites/default/files/ct/news/documents/2021-01/2021_reuters_tracking_-_core_political_presidential_approval_tracker_01_22_2021.pdf
## 4                                                 https://assets.morningconsult.com/wp-uploads/2021/01/21155806/210166_crosstabs_MC_WASHINGTON_RVs_v2.pdf
## 5                                                                                                 https://morningconsult.com/form/global-leader-approval/
## 6                                                                          https://docs.cdn.yougov.com/u3h9dresbn/20210120_yahoo_coronavirus_toplines.pdf
##   poll_id question_id createddate            timestamp
## 1   74272      139491   1/28/2021 17:17:07 30 Aug 2021
## 2   74247      139395   1/22/2021 17:17:07 30 Aug 2021
## 3   74248      139404   1/22/2021 17:17:07 30 Aug 2021
## 4   74246      139394   1/22/2021 17:17:07 30 Aug 2021
## 5   74273      139492   1/28/2021 17:17:07 30 Aug 2021
## 6   74327      139570    2/2/2021 17:17:07 30 Aug 2021

Conclusion

Approval ratings have historically tended to revert to the mean, and also to deteriorate slightly over the course of a president’s term, we expect Biden’s approval rating to decline and his disapproval rating to rise. But as you can see, the 90-percent confidence interval for both approval and disapproval gets much wider the further you go into the future, meaning a wide range of outcomes are possible for Biden’s long-term popularity. Even in this age of intense polarization, circumstances and actions can still affect the president’s approval rating, so Biden’s political future is at least partly in his own hands.

approval_topline<-read.csv("https://projects.fivethirtyeight.com/biden-approval-data/approval_topline.csv")
approval_topline<-data.frame(approval_topline)
head(approval_topline)
##             president  subgroup modeldate approve_estimate approve_hi
## 1 Joseph R. Biden Jr.    Voters 8/30/2021         46.68121   51.32192
## 2 Joseph R. Biden Jr.    Adults 8/30/2021         48.57093   52.84799
## 3 Joseph R. Biden Jr. All polls 8/30/2021         47.21688   51.88746
## 4 Joseph R. Biden Jr. All polls 8/29/2021         47.24047   51.96084
## 5 Joseph R. Biden Jr.    Voters 8/29/2021         47.00941   51.81215
## 6 Joseph R. Biden Jr.    Adults 8/29/2021         48.47553   52.79694
##   approve_lo disapprove_estimate disapprove_hi disapprove_lo
## 1   42.04049            48.05923      53.59818      42.52028
## 2   44.29386            45.49554      49.89033      41.10074
## 3   42.54631            47.45036      52.96876      41.93197
## 4   42.52010            46.94567      52.44047      41.45087
## 5   42.20668            47.50099      53.12789      41.87409
## 6   44.15412            45.63327      50.07061      41.19592
##              timestamp
## 1 17:17:11 30 Aug 2021
## 2 17:17:09 30 Aug 2021
## 3 17:17:07 30 Aug 2021
## 4 08:13:12 30 Aug 2021
## 5 08:13:23 30 Aug 2021
## 6 08:13:19 30 Aug 2021

Links:

https://github.com/Gunduzhazal/J.Biden.Approval-poll

http://rpubs.com/gunduzhazal/803090