Skip to content

Instantly share code, notes, and snippets.

View elliottmorris's full-sized avatar

G. Elliott Morris elliottmorris

View GitHub Profile
@elliottmorris
elliottmorris / gen_corr_draw.R
Created March 2, 2018 15:39
Fit Correlation Matrix
# function written by HuffPost Pollster's Natalie Jackson for the 2016 election
# ibraries and import --------
library(dplyr)
library('Matrix')
seat_data <- read.csv("seat_partisanship_demog.csv") # read in a 435
seat_data <- seat_data %>%
select(clinton2016, obama2012, house2016, pct_nonwhite)
@elliottmorris
elliottmorris / main.R
Created June 17, 2017 23:03
Predicting #GA06
# Libraries, data, setup ####
rm(list=ls())
library(tidyverse)
library(gridExtra)
library(googlesheets)
source("~/Desktop/theme_elliott.R")
# load in data from Gsheet
my_sheets <- gs_ls()
@elliottmorris
elliottmorris / AHCA_Opinion.R
Last active March 23, 2017 23:51
Code for analyzing public opinion and healthcare CBO impact numbers for the AHCA
## R Code for analysing AHCA CBO outlook and congress data
## Written by G. Elliott Morris
## @gelliottmorris | [email protected] | TheCrosstab.com
## please do not replicate the analysis without permission.
##
## Additional info:
## DOWNLOAD DATA AT http://bit.ly/2oa0RPa
## Github Gist lives at: http://bit.ly/2nI5bZu
# libraries ####
@elliottmorris
elliottmorris / CCES.R
Last active August 5, 2021 16:47
Analyzing the 2016 CCES
## R Code for Analysing the 2016 Cooperative Congressional Election Study
## Written by G. Elliott Morris
## @gelliottmorris | [email protected] | TheCrosstab.com
## please do not replicate the analysis without permission.
##
## Additional info:
## DOWNLOAD DATA AT https://dataverse.harvard.edu/dataset.xhtml?persistentId=doi:10.7910/DVN/GDF6Z0
## Github Gist lives at: https://gist.github.com/elliottmorris/79141ff0f0c3824798ce3b84f18b817b
### libraries & functions ####
@elliottmorris
elliottmorris / trump_approval_effects.R
Last active April 9, 2018 11:55
Trump approval house effects
##################################
# Code for house-correcting Trump approval polls
# Written by Alexander Agadjanian and G. Elliott Morris
# for use on Elliott's blog, TheCrosstab.com.
# @a_agadjanian @GElliottMorris
#
# Github Gist lives at https://gist.github.com/elliottmorris/905bd514110ea7d0b599cfca8a8e7332
####################################
# libraries ####
@elliottmorris
elliottmorris / fivethiRtyeight
Created January 12, 2017 17:34
A short intro to 538's r package
###################################
# exploring the 538 package
# code by G. Elliott Morris, @gelliottmorris
###################################
#install pacakges
install.packages(c("fivethirtyeight","ggplot2","dplyr","ggthemes"))
#load them
library(fivethirtyeight)