Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original code is from https://gist.github.com/aaronshaf/1346968 | |
The instructions were to open a dev console and paste in the script. | |
A nicer way is to make it a bookmarklet. | |
1. Create a new bookmark in our browser. You should be able to edit the name and URL | |
2. Give it a decent name (e.g. "amz cloud plaintext") | |
3. Paste the following as the URL (make it all one line): |
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
# | |
# Get All Unique Domain Names from comScore | |
# | |
# INPUT: comScore browsing data file | |
# | |
# OUTPUT: a text file containing a list of unique domains | |
# | |
# PAREMETERS: | |
# + INTERNET_USAGE_FILE: path to the comScore browsing data | |
# + FINAL_OUTPUT_FILE: path to intended output file |
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
devtools::install_github("abresler/gdeltr2") | |
devtools::install_github("hafen/trelliscopejs") | |
library(gdeltr2) | |
library(dplyr) | |
asb_ocr <- "Brooklyn Nets" | |
gkg_codes <- | |
get_codes_gkg_themes() | |
imageweb_codes <- get_gdelt_codebook_ft_api(code_book = "imageweb") |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
> median(FALSE) | |
[1] FALSE | |
> median(c(TRUE, FALSE)) | |
[1] 0.5 | |
> median(c(TRUE, FALSE, TRUE)) | |
[1] TRUE | |
> f <- factor(c('a', 'b', 'c'), levels = c('a', 'b', 'c'), ordered = TRUE) |
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
# Read the data | |
sf <- read.csv("sf_tenants.csv") | |
# Recode | |
sf$market_rates <- gsub("%", "", sapply(strsplit(sf$market_rate, " / "), "[", 2)) # market_rate | |
sf$rent_control_rates <- gsub("%", "", sapply(strsplit(sf$rent_control, " / "), "[", 2)) # market_rate | |
# Ratio of rent_control vs. rent_control | |
sf$ratio <- as.numeric(sf$rent_control_rates)/as.numeric(sf$market_rates) |
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 libs | |
library(ggplot2) | |
# Simulate correlated data | |
R = matrix(cbind(1,.80, .80,1), nrow=2) | |
U = t(chol(R)) |
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
state | code | num | census | icpsr | icpsr2 | |
---|---|---|---|---|---|---|
Alabama | AL | 1 | South | 41 | 41 AL ALABAMA | |
Alaska | AK | 2 | West | 81 | 81 AK ALASKA | |
Arizona | AZ | 3 | West | 61 | 61 AZ ARIZONA | |
Arkansas | AR | 4 | South | 42 | 42 AR ARKANSAS | |
California | CA | 5 | West | 71 | 71 CA CALIFORNIA | |
Colorado | CO | 6 | West | 62 | 62 CO COLORADO | |
Connecticut | CT | 7 | Northeast | 1 | 01 CT CONNECTICUT | |
Delaware | DE | 8 | South | 11 | 11 DE DELAWARE | |
District of Columbia | DC | 9 | Northeast | 55 | 55 DC DISTRICT OF COLUMBIA |