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
| g<-gvisBubbleChart(Fruits, idvar="Fruit", xvar="Date", yvar="Sales", colorvar="Fruit", sizevar="Profit", options=list(hAxis.format="{format:'Y-MMM-d'}")) |
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(XML) | |
| library(RCurl) | |
| library(ggplot2) | |
| results <- c() | |
| ## Loop through the 30 pages of player data | |
| for(i in 1:30){ | |
| theURL <- paste("http://www.nhl.com/ice/playerstats.htm?fetchKey=20122ALLSASAll&viewName=summary&sort=points&pg=", i, sep="") | |
| webpage <- getURL(theURL) |
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
| setwd("R/") | |
| setwd("NFL Play-by-Play Data 2002-2012/") | |
| ## read in the sweet, sweet NFL data | |
| seasons <- c(2002:2011) | |
| n <- read.csv("2012_nfl_pbp_data_reg_season.csv", header=TRUE, stringsAsFactors=FALSE) | |
| n1 <- read.csv("2002_nfl_pbp_data.csv", header=TRUE, stringsAsFactors=FALSE) | |
| n <- n[,-which(is.na(match(colnames(n), colnames(n1))))] | |
| for(i in seasons){ | |
| n1 <- read.csv(paste(i, "_nfl_pbp_data.csv", sep=""), header=TRUE, stringsAsFactors=FALSE) |
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(pitchRx) | |
| ## scrape all pitchFX data from May 4th, 2012 | |
| dat <- scrapeFX(start = "2012-05-04", end = "2012-05-04") | |
| ## Join tables for data analysis | |
| pitchFX <- join(dat$pitch, dat$atbat, by = c("num", "url"), type = "inner") | |
| pitches <- subset(bos, pitcher_name = "Jon Lester") | |
| facets <- facet_grid(. ~ stand) | |
| strikeFX(pitches, geom = "tile") + facets |
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 csv | |
| import re | |
| import urllib2 | |
| from bs4 import BeautifulSoup | |
| page = urllib2.urlopen("http://fantasyfootballcalculator.com/completed_drafts.php?format=standard").read() | |
| soup = BeautifulSoup(page) | |
| #print soup.prettify() |
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 csv | |
| import re | |
| import sys | |
| import urllib2 | |
| from bs4 import BeautifulSoup | |
| page = urllib2.urlopen("http://fantasyfootballcalculator.com/completed_drafts.php?format=standard").read() | |
| soup = BeautifulSoup(page) | |
| #print soup.prettify() |
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
| require(shiny) | |
| require(rCharts) | |
| inputChoices <- c("A", "B", "C", "D") | |
| shinyServer(function(input, output, session){ | |
| input2Choices <- reactive({ | |
| inputChoices[-grep(input$input1, inputChoices)] | |
| }) |
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
| .chart_container { | |
| position: relative; | |
| display: inline-block; | |
| font-family: Arial, Helvetica, sans-serif; | |
| } | |
| .rChart { | |
| display: inline-block; | |
| margin-left: 40px; | |
| } | |
| .yAxis { |
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
| require(shiny) | |
| require(rCharts) | |
| inputChoices <- c("A", "B", "C", "D") | |
| adf <- data.frame(val1=sample(inputChoices), val2=sample(inputChoices)) | |
| shinyServer(function(input, output, session){ | |
| input2Choices <- reactive({ |
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
| require(shiny) | |
| require(rCharts) | |
| inputChoices <- c("A", "B", "C", "D") | |
| adf <- data.frame(val1=sample(inputChoices), val2=sample(inputChoices)) | |
| shinyServer(function(input, output, session){ | |
| input2Choices <- reactive({ |
OlderNewer