Skip to content

Instantly share code, notes, and snippets.

View Btibert3's full-sized avatar

Brock Tibert Btibert3

View GitHub Profile
@Btibert3
Btibert3 / MA Gubernatorial 2010.R
Created November 3, 2010 00:54
Follow along with the results for the race
# Parse MA Gubernatorial Race 2010
#############################
# Purpose: use R to scrape data and plot results in real-time
# NOTE: I am still new to R, so this is very basic!
# source of code snippet as help for this:
# http://stackoverflow.com/questions/1395528/scraping-html-tables-into-r-data-frames-using-the-xml-package
#############################
#######################################################################
# Create social network from NCES 2008 migration data
# Helpful resources:
# R in a Nutshell -- Adler
# R for SAS and SPSS Users
# statmethods.net -- Quick R
# igraph.sourceforge.net
#######################################################################
# Load libraries
@Btibert3
Btibert3 / IPEDS Grad and Yield Rate.R
Created January 12, 2011 22:55
Correlate 6-year Grad Rate with Freshmen Yield Rate
################################################################
# Author: @BrockTibert
# Date: January 2011
#
# Purpose: Study the relationship of freshmen yield rate and grad rate
# Comes from Chronicle blog post on research done about college selection
# and more likely to be selected if have higher grad rate. Let's use
# actual data to see if this is true.
#
# http://chronicle.com/blogs/headcount/how-graduation-rates-shape-college-choice/27770
@Btibert3
Btibert3 / Cluster NHL Players.R
Created February 6, 2011 18:57
Pull in Web data, and cluster them based on performance
###############################################################################
# Author: @BrockTibert
#
# Used: R Version 2.12.1, Windows 7 Pro, StatET Plugin for Eclipse
#
#
###############################################################################
#-----------------------------------------------------------------------
# set up script level basics
###############################################################################
# Author: @BrockTibert
# Purpose: Collect Historical NHL Skater Stats 1960 - 2011 (in progress)
# Date: February 2011
#
# Used: R Version 2.12.1, Windows 7 Pro, StatET Plugin for Eclipse
#
# # Copyright (c) 2011, under the Simplified BSD License.
# For more information on FreeBSD see: http://www.opensource.org/licenses/bsd-license.php
# All rights reserved.
###############################################################################
# Date: Feb 13, 2011
# Author: @BrockTibert
# Filename: NHL PBP and Tableau.R
# R version: 2.12.1
#
# Purpose: Grab the Play by Play event data and visualize live using Tableau
#
#
# Copyright (c) 2011, under the Simplified BSD License.
@Btibert3
Btibert3 / Player Streak.R
Created April 1, 2011 23:06
Player Streakiness in the NHL
## basics
# R 2.12.2
# windows xp; Yes, I know
## libraries
library(XML)
library(plyr)
library(lubridate)
library(ggplot2)
@Btibert3
Btibert3 / 30 Goals and 100 PIM.R
Created April 2, 2011 18:39
Function to grab NHL Skater Stats for a season
# Source the file with the Grab Skaters function
setwd("~/My Dropbox/Eclipse/Projects/R/NHL/Blog Posts/Scripts")
source("SkaterStats.R")
## set the working directory
setwd("~/My Dropbox/Eclipse/Projects/R/NHL/Blog Posts/30 Goals 100 PIM")
## set the seasons
SEASON <- as.character(c(1960:2004, 2006:2011))
@Btibert3
Btibert3 / NHL 2011 Defensive Stats.R
Created June 23, 2011 00:55
2011 NHL D Statistics
# set working directory
setwd("/My Dropbox/Projects/NHL Defensemen 2011 performance")
# load the libraries I commonly use
library(XML)
library(plyr)
library(lubridate)
library(ggplot2)
# grab the data
@Btibert3
Btibert3 / NHLcom Player Stats.R
Created June 24, 2011 00:19
Parse the 2010-11 Player Stats
#===================================================================
# load the libraries
#===================================================================
library(XML)
library(plyr)
#===================================================================
# grab the first page of data
#===================================================================
# U<-"http://www.nhl.com/ice/app?service=page&page=playerstats&fetchKey=20113ALLAASAll&viewName=summary&sort=points&pg=1"