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
# somewhat hackish solution to: | |
# https://twitter.com/EamonCaddigan/status/646759751242620928 | |
# based mostly on copy/pasting from ggplot2 geom_violin source: | |
# https://github.com/hadley/ggplot2/blob/master/R/geom-violin.r | |
library(ggplot2) | |
library(dplyr) | |
"%||%" <- function(a, b) { |
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
# Installation | |
#install.packages("devtools") | |
devtools::install_github("rich-iannone/DiagrammeR") | |
library(DiagrammeR) | |
# Create and render an empty graph | |
empty_graph <- create_graph() | |
render_graph(empty_graph, output = "visNetwork") |
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
packages <- #need all of these installed including some from github | |
c('dplyr', | |
'magrittr', | |
'jsonlite', | |
'tidyr', | |
'stringr', | |
'lubridate') | |
options(warn = -1) | |
lapply(packages, library, character.only = T) |
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(SmarterPoland) | |
library(riverplot) | |
library(RColorBrewer) | |
library(graphics) | |
library(reshape2) | |
library(plyr) | |
library(stringr) | |
library(countrycode) | |
# DOWNLOAD THE DATA |
We can make this file beautiful and searchable if this error is corrected: It looks like row 5 should actually have 34 columns, instead of 5 in line 4.
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
name.table,id.season,is.offense,name.player,team,id.player,jersey,id.position,id.team,slug.team,city.team,gp,possesions,pct.play_type,pts,fga,fgm,ppp,ppp.worse,ppp.better,possesions.per_game,pts.per_game,fga.per_game,fgm.per_game,fg.miss.per_game,rank,pct.fg,pct.efg,pct.ft_achieved,pct.to,pct.shooting_foul,pct.and_1,pct.scored,stem.table | |
Post-Up,2015-16,TRUE,Paul Millsap,Atlanta Hawks,200794,4,F,1610612737,ATL,Atlanta,4,13,19.69700050354,20,8,7,1.53846001625061,25,0,3.25,5,2,1.75,0.25,1,87.5,87.5,30.7692307692308,15.3846153846154,30.7692307692308,7.69230769230769,76.9230769230769,Postup | |
Post-Up,2015-16,TRUE,Al Horford,Atlanta Hawks,201143,15,F-C,1610612737,ATL,Atlanta,4,11,15.0684995651245,12,8,6,1.09090995788574,17,7,2.75,3,2,1.5,0.5,2,75,75,0,27.2727272727273,0,0,54.5454545454545,Postup | |
Post-Up,2015-16,FALSE,Kent Bazemore,Atlanta Hawks,203145,24,G,1610612737,ATL,Atlanta,4,11,22.917,7,7,1,0.636,5,4,2.75,1.75,1.75,0.25,1.5,6,14.286,14.286,27.273,9.091,27.273,0,36.364,Postup | |
Post-Up,2015-16,FALSE,Al Horford,A |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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(ggplot2) # devtools::install_github("hadley/ggplot2") or subtitles won't work | |
library(tidyr) | |
library(dplyr) | |
library(readr) | |
library(scales) | |
URL <- "https://static01.nyt.com/newsgraphics/2016/04/21/undervote/ad8bd3e44231c1091e75621b9f27fe31d116999f/data.tsv" | |
fil <- "nytimes_vote.tsv" | |
if (!file.exists(fil)) download.file(URL, fil) |
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
# devtools::install_github('jalapic/engsoccerdata') | |
library(engsoccerdata) | |
library(dplyr) | |
library(plotly) | |
library(htmlwidgets) | |
england$Date <- as.Date(england$Date, format = "%Y-%m-%d") | |
#Get Data into Format Needed | |
df<-rbind( |
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
from __future__ import print_function | |
import copy | |
class permutor: | |
def __init__(self, infile='curley_seq.txt', max_entries=-1): | |
self.indata = self.read_infile(infile) | |
if max_entries>0: | |
self.indata = self.indata[0:max_entries] |
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
# read in Lahman batting and master files | |
# can also use Lahman package -- data is only through 2014 season | |
Batting <- read.csv("~/OneDriveBusiness/lahman-csv_2015-01-24/Batting.csv") | |
Master <- read.csv("~/OneDriveBusiness/lahman-csv_2015-01-24/Master.csv") | |
# find players with at least 500 career homes (through 2015) | |
library(dplyr) |