R bloggers

R⁶ — Disproving Approval

FavoriteLoadingAdd to favorites

I couldn’t let this stand unchallenged: The new Rasmussen Poll, one of the most accurate in the 2016 Election, just out with a Trump 50% Approval Rating.That’s higher than O’s #’s! — Donald J. Trump (@realDonaldTrump) June 18, 2017 Ramussen makes their Presidential polling data available for both 🍊 & O. Why not compare their ratings from day 1 in office (skipping days that Ramussen doesn’t poll)? library(hrbrthemes) library(rvest) library(tidyverse) list( Obama=”http://m.rasmussenreports.com/public_content/politics/obama_administration/obama_approval_index_history”, Trump=”http://m.rasmussenreports.com/public_content/politics/trump_administration/trump_approval_index_history” ) %>% map_df(~{ read_html(.x) %>% html_table() %>% .[[1]] %>% tbl_df() %>% select(date=Date, approve=Total Approve, disapprove=Total Disapprove) }, .id=”who”) -> ratings mutate_at(ratings, c(“approve”, “disapprove”), function(x) as.numeric(gsub(“%”, “”, x, fixed=TRUE))/100) %>% mutate(date = lubridate::dmy(date)) %>% filter(!is.na(approve)) %>% group_by(who) %>% arrange(date) %>% mutate(dnum = 1:n()) %>% ungroup() %>% ggplot(aes(dnum, approve, color=who)) + geom_hline(yintercept = 0.5, size=0.5) + geom_point(size=0.25) + scale_y_percent(limits=c(0,1)) + scale_color_manual(name=NULL, values=c(“Obama”=”#313695”, “Trump”=”#a50026″)) + labs(x=”Day in office”, y=”Approval…
Original Post: R⁶ — Disproving Approval