The article shows various graphs comparing how Americans view Biden’s handling of the pandemic to that of Trump. Americans answered questions regarding the following subjects: Presidential response; their feelings about infections; and feelings about the economy.
This assignment focuses on data concerning the following question: Do Americans approve of Biden’s response to the coronavirus crisis?
Article Link: https://projects.fivethirtyeight.com/coronavirus-polls/
The first block sets this project’s configurations and include packages for the rest of the markdown file.
knitr::opts_chunk$set(echo = TRUE)
# Packages listings
# For str_replace function
library(stringr)
# Basic data frame operations
library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
## ✓ ggplot2 3.3.5 ✓ purrr 0.3.4
## ✓ tibble 3.1.3 ✓ dplyr 1.0.7
## ✓ tidyr 1.1.3 ✓ forcats 0.5.1
## ✓ readr 2.0.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
# Load the CSV from Github
data_frame = read.table(file="https://raw.githubusercontent.com/cliftonleesps/607_acq_mgt/main/covid-19-polls-master/covid_approval_polls_adjusted.csv", header=TRUE,sep=",")
This block performs a couple of basic data frame operations:
# Since we only want to know about Biden's approval rating, we'll filter out observations where he is not the President
data_frame <- filter(data_frame, subject == 'Biden')
# Remove a few unnecessary columns
data_frame <- select(data_frame, party,enddate, pollster, samplesize,approve_adjusted,disapprove_adjusted)
# Sort by Poll Date, party
data_frame <- arrange(data_frame, enddate, party)
# Reorder the columns
data_frame <- data_frame[,c("enddate","pollster","samplesize","party","approve_adjusted","disapprove_adjusted")]
The next block further helps the reader by renaming observations to more meaningful values. Any explanation of values can be retrieved via their Github page listed below.
Link: https://github.com/fivethirtyeight/covid-19-polls
# Map party key value pairs
data_frame$party <- str_replace(string=data_frame$party, pattern="^D$", replacement="Democrat")
data_frame$party <- str_replace(string=data_frame$party, pattern="^R$", replacement="Republican")
data_frame$party <- str_replace(string=data_frame$party, pattern="^I$", replacement="Independent")
data_frame$party <- str_replace(string=data_frame$party, pattern="^all$", replacement="All")
# Transform participants by rounding them to integers
data_frame$samplesize <- round(data_frame$samplesize)
# Round the adjusted approval/disapproval percentage columns to 1 significant digit
data_frame$approve_adjusted <- round(data_frame$approve_adjusted, digits = 1)
data_frame$disapprove_adjusted <- round(data_frame$disapprove_adjusted, digits = 1)
# Rename headers for readability
data_frame <- rename(data_frame, Party = party)
data_frame <- rename(data_frame, Participants = samplesize )
data_frame <- rename(data_frame, Pollster = pollster )
data_frame <- rename(data_frame, "Approval Pct" = approve_adjusted)
data_frame <- rename(data_frame, "Disapproval Pct" = disapprove_adjusted)
data_frame <- rename(data_frame, "Poll Date"= enddate)
# Show the final subset
head(data_frame, n=10)
## Poll Date Pollster Participants Party Approval Pct
## 1 1/22/2021 Harris Insights & Analytics 941 All 64.7
## 2 1/23/2021 Ipsos 504 All 66.1
## 3 1/26/2021 Echelon Insights 1006 All 59.5
## 4 1/26/2021 YouGov 1500 All 57.3
## 5 1/26/2021 YouGov 477 Democrat 86.9
## 6 1/26/2021 YouGov 645 Independent 52.5
## 7 1/26/2021 YouGov 369 Republican 28.8
## 8 1/29/2021 IBD/TIPP 1261 All 57.9
## 9 2/1/2021 Quinnipiac University 1075 All 60.8
## 10 2/1/2021 Morning Consult 1986 All 60.7
## Disapproval Pct
## 1 30.3
## 2 29.9
## 3 23.0
## 4 25.4
## 5 2.3
## 6 22.3
## 7 51.7
## 8 24.8
## 9 29.1
## 10 30.1
The answer to the central question is yes, a majority of Americans approve of Biden’s handling of the corona virus epidemic. His latest poll numbers among independents remains 57%, 25% for Republicans and 92% for Democrats.