[ Launch: creds ] 6107792 by seanjtaylor
This file contains hidden or 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
| library(rvest) | |
| library(dplyr) | |
| html.doc <- read_html('http://www.footballoutsiders.com/stat-analysis/2016/quarterbacks-and-progression-air-yards') | |
| # Extract table | |
| raw.table <- html.doc %>% | |
| html_table() %>% | |
| first |
This file contains hidden or 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
| library(rvest) | |
| library(dplyr) | |
| library(stringr) | |
| library(ggplot2) | |
| tbls <- read_html('https://en.wikipedia.org/wiki/List_of_serial_killers_by_number_of_victims') %>% html_table() | |
| t1 <- tbls[[1]] %>% select(name = Name, country = Country, years = `Years active`, victims = `Proven victims`) %>% mutate(victims = as.character(victims)) | |
| t2 <- tbls[[2]] %>% select(name = Name, country = Country, years = `Years active`, victims = `Proven victims`) |
This file contains hidden or 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
| library(dplyr) | |
| library(ggplot2) | |
| library(rvest) | |
| library(tidyr) | |
| html.doc <- read_html('http://www.footballoutsiders.com/stat-analysis/2016/quarterbacks-and-progression-air-yards') | |
| # Extract table | |
| raw.table <- html.doc %>% | |
| html_table() %>% |
This file contains hidden or 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
| library(rvest) | |
| library(stringr) | |
| library(dplyr) | |
| library(ggplot2) | |
| library(tidyr) | |
| min.fun <- function(p, thresh.prob = NULL, thresh = NULL) { | |
| (thresh.prob - pbinom(thresh, 16, p))^2 | |
| } |
This file contains hidden or 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
| library(rvest) | |
| library(stringr) | |
| library(readr) | |
| library(ggplot2) | |
| library(dplyr) | |
| library(tidyr) | |
| library(broom) | |
| library(lubridate) | |
| base.url <- 'http://www.pro-football-reference.com/' |
This file contains hidden or 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
| df <- data.frame(higher = c('US', 'CA', 'MX'), | |
| lower = c('CA', 'MX', 'MX')) | |
| levels <- c('US', 'CA', 'MX') | |
| X.l <- model.matrix(~ 0 + factor(higher, levels = levels), data = df) | |
| X.r <- model.matrix(~ 0 + factor(lower, levels = levels), data = df) | |
| X <- X.l - X.r | |
| colnames(X) <- levels # makes it easier to interpret regression output |
This file contains hidden or 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
| import pandas as pd | |
| import scipy.sparse as sps | |
| df = pd.DataFrame({'tag1': ['sean', 'udi', 'bogdan'], 'tag2': ['sean', 'udi', 'udi'], 'freq': [1,2,3]}) | |
| # tag1 -> rows, tag2 -> columns | |
| df.set_index(['tag1', 'tag2'], inplace=True) | |
| mat = sps.coo_matrix((df.freq, (df.index.labels[0], df.index.labels[1]))) | |
| print(mat.todense()) |
This file contains hidden or 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
| library(mgcv) | |
| library(ggplot2) | |
| library(dplyr) | |
| library(XML) | |
| library(weatherData) | |
| us.airports.url <- 'http://www.world-airport-codes.com/us-top-40-airports.html' | |
| us.airports <- readHTMLTable(us.airports.url)[[1]] %>% | |
| filter(!is.na(IATA)) %>% |
This file contains hidden or 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
| <html> | |
| <head> | |
| <style> | |
| rect.background { | |
| fill: #EEE; | |
| } | |
| line.rule { | |
| stroke: #FFF; | |
| } | |
| text.labels { |