layout | title | description | tags | ||
---|---|---|---|---|---|
default |
SQL Style Guide |
A guide to writing clean, clear, and consistent SQL. |
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 AL | |
2 AK | |
4 AZ | |
5 AR | |
6 CA | |
8 CO | |
9 CT | |
10 DE | |
11 DC | |
12 FL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# load packages | |
library(magrittr) | |
library(googlesheets) | |
library(lubridate) | |
library(dplyr) | |
library(stringr) | |
library(tidyr) | |
library(ggplot2) | |
library(maps) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Name | District | Education | Science | Law | |
---|---|---|---|---|---|
Jeff Sessions (R) | AL-Senate | B.A., Huntingdon College; J.D. University of Alabama School of Law | 1 | ||
Richard Shelby (R) | AL-Senate | B.A., University of Alabama; J.D. University of Alabama School of Law | 1 | ||
Jo Bonner (R) | AL-1 | B.A. Journalism, University of Alabama | 0 | ||
Bobby Bright (D) | AL-2 | B.A. Political Science, Auburn University; M.S. Criminal Justice, Troy State University; J.D. Thomas Goode Jones School of Law | 1 | ||
Mike Rogers (R) | AL-3 | B.A., Political Science; M.P.A., Jackson State University; J.D. Birmingham School of Law | 1 | ||
Robert Aderholt (R) | AL-4 | B.A., Political Science/History, Birmingham Southern College; J.D., Samford University | 1 | ||
Partker Griffith (D) | AL-5 | B.S.; M.D., Louisiana State University | 0 | ||
Spencer Bachus (R) | AL-6 | B.A., Auburn University; J.D., University of Alabama | 1 | ||
Artur Davis (D) | AL-7 | B.A., Government, Harvard University; J.D., Harvard University School of Law | 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#' Manual classification of observations | |
#' | |
#' \code{classify} launches a Shiny app to manually classify a subset of observations. | |
#' | |
#' @param x A character vector. | |
#' @param btn_labels A character vector of length 2 corresponding to 0 and 1. | |
#' @return A vector of 0/1 for each element in \code{x}. | |
#' @export | |
#' @examples \dontrun{ | |
#' foo <- sprintf('%s (%.2f miles per gallon)', rownames(mtcars), mtcars$mpg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
redpeak=function(s,w){ | |
x=c(0,0,1,NA, 1,2,2,NA,0.5,1,1.5) | |
y=c(0,1,1,NA,1,1,0,NA,0,0.5,0) | |
polygon(x*w+s[1],y*w+s[2],col=c("black","navyblue","#98332f")) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apt-get upgrade | |
apt-get update | |
sudo aptitude install emacs24 | |
sudo aptitude install r-base | |
sudo aptitude install libcurl4-openssl-dev | |
sudo aptitude install libxml2-dev | |
apt-get install openjdk-7-* | |
R CMD javareconf -e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" | |
Weighting by Propensity Scores | |
Last Edited: 5/31/2015 | |
Task Outline: | |
1. Two datasets: | |
dataset 1: large pop. representative sample | |
dataset 2: convenient sample | |
2. Create weights for dataset 2 so that its marginals are close to dataset 1 on some vars. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" | |
Basic Text Classifier | |
- Takes a csv with a text column, and column of labels | |
- Splits into train and test | |
- Preprocesses text using tm/bag-of-words, 1/2-order Markov | |
- Uses SVM and Lasso | |
@author: Gaurav Sood | |
" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
What does it do? | |
Goes through a corrupted csv sequentially and outputs rows that are clean. | |
Also outputs, total n, total corrupted n | |
@author: Gaurav Sood | |
Run: python salvage_csv.py input_csv output_csv | |
''' |