Skip to content

Instantly share code, notes, and snippets.

###############################################
# working with complete set of 2015 play-by-play data
# collected using the getData function in the openWAR
# package (retrieves MLBAM GameDay files)
# currently have this saved as a Rdata file
###############################################
load("alldata2015.Rdata")
# computes the run values of all plate appearances
@hrbrmstr
hrbrmstr / zellig.r
Last active January 7, 2016 02:00
Single-source file for http://bit.ly/zellingenach
#' The single-file, 'source'-able version of https://github.com/hrbrmstr/zellingenach
#' More info here: http://bit.ly/zellingenach
#' By @hrbrmstr (2016)
#' MIT LICENSE
# NOTE THAT YOU NEED INTERNET ACCESS TO RUN THIS SCRIPT
# it pulls the three necessary files (only once) from my web site
library(V8)
library(dplyr)
## source: https://github.com/toddwschneider/nyc-taxi-data/blob/master/analysis/analysis.R
dropoffs = query("SELECT * FROM dropoff_by_lat_long_cab_type ORDER BY count")
dropoffs = mutate(dropoffs, cab_type_id = factor(cab_type_id))
p = ggplot() +
geom_polygon(data = ex_staten_island_map,
aes(x = long, y = lat, group = group),
fill = "#080808", color = "#080808") +
geom_point(data = dropoffs,
aes(x = dropoff_long, y = dropoff_lat, alpha = count, size = count, color = cab_type_id)) +
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
belief y2015 y2014
Improves the security posture of my organization 0.75 0.71
Improves the security posture of the nations critical infrastructure 0.63 0.64
Reduces the cost of detecting and preventing cyber attacks 0.22 0.21
Improves situational awareness 0.60 0.54
Fosters collaboration among peers and industry groups 0.48 0.51
Enhances the timeliness of threat data 0.11 0.16
Makes threat data more actionable 0.21 0.24
@mick001
mick001 / copulas_example.R
Last active July 23, 2024 04:09
Modelling dependence with copulas. Full article at: http://datascienceplus.com/modelling-dependence-with-copulas/
#Load library mass and set seed
library(MASS)
set.seed(100)
# We are going to use 3 random variables
m <- 3
# Number of samples to be drawn
n <- 2000
@fototo
fototo / customer-segmentation.py
Last active September 14, 2015 23:49 — forked from glamp/customer-segmentation.py
Analysis for customer segmentation blog post
import pandas as pd
# http://blog.yhathq.com/static/misc/data/WineKMC.xlsx
df_offers = pd.read_excel("./WineKMC.xlsx", sheetname=0)
df_offers.columns = ["offer_id", "campaign", "varietal", "min_qty", "discount", "origin", "past_peak"]
df_offers.head()
df_transactions = pd.read_excel("./WineKMC.xlsx", sheetname=1)
df_transactions.columns = ["customer_name", "offer_id"]
df_transactions['n'] = 1
df_transactions.head()
@glamp
glamp / customer-segmentation.py
Last active April 30, 2020 13:40
Analysis for customer segmentation blog post
import pandas as pd
# http://blog.yhathq.com/static/misc/data/WineKMC.xlsx
df_offers = pd.read_excel("./WineKMC.xlsx", sheetname=0)
df_offers.columns = ["offer_id", "campaign", "varietal", "min_qty", "discount", "origin", "past_peak"]
df_offers.head()
df_transactions = pd.read_excel("./WineKMC.xlsx", sheetname=1)
df_transactions.columns = ["customer_name", "offer_id"]
df_transactions['n'] = 1
df_transactions.head()
@e9t
e9t / README.md
Last active August 29, 2015 14:20 — forked from cornchz/README.md
롯데리아 보로노이
@e9t
e9t / README.md
Last active June 9, 2020 06:09
식신로드 만점 식단 20선