Skip to content

Instantly share code, notes, and snippets.

tcash21

Block or report user

Report or block tcash21

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View lol.R
library(rvest)
library(jsonlite)
#/lol/summoner/v3/summoners/{summonerId}
#/lol/match/v3/matchlists/by-account/{accountId}
key <- 'Your-API-KEY'
summoner_id <- '88770698'
base_url <- 'https://na1.api.riotgames.com'
@tcash21
tcash21 / full_openvis_analysis.R
Created May 13, 2017
OpenVisConf Transcript Analysis
View full_openvis_analysis.R
library(rvest)
library(tidytext)
library(stringr)
library(purrr)
library(ggplot2)
library(tidyr)
options(stringsAsFactors = FALSE)
## use phantomjs to download the webpage content (javascript-generated)
View d3-console-example
d3.csv("../data/imdb.csv", function(data) {
dataset = data
});
offset = 2
circles = d3.select("body")
.append("svg")
.attr("width", width)
View benford_elections.R
library(benford.analysis)
## read in data
counties <- read.csv(file="https://raw.githubusercontent.com/Prooffreader/election_2016_data/master/data/presidential_general_election_2016_by_county.csvhttps://raw.githubusercontent.com/Prooffreader/election_2016_data/master/data/presidential_general_election_2016_by_county.csv")
## Run Benford tests
hrc <- benford(subset(counties, name == 'H. Clinton')$votes)
trump <- benford(subset(counties, name == 'D. Trump')$votes)
## plot results
@tcash21
tcash21 / spinner.gif
Created Oct 15, 2016
Shiny loading spinner
View spinner.gif
conditionalPanel(id='loader',
condition="($('html').hasClass('shiny-busy'))",
img(src="spinner.gif")
),
@tcash21
tcash21 / server.R
Created Sep 7, 2016
radarchart jittery issue
View server.R
library(radarchart)
labs <- c(1:25)
scores <- list("Rich" = rnorm(25, 1, 10),
"Andy" = rnorm(25, 10, 5),
"Aimee" = rnorm(25, 20, 5))
View win_lose_or_draw.R
library(stattleshipR)
library(dplyr)
library(ggplot2)
set_token("YOUR_TOKEN_GOES_HERE")
## pull all 'team_game_logs' from the Stattleship API
## set parameters here
View stattleship_mlb_demo.R
install.packages("devtools")
devtools::install_github("stattleship/stattleship-r")
install.packages('dplyr')
install.packages('ggplot2')
## Load the stattleshipR package
library(stattleshipR)
library(dplyr)
library(ggplot2)
View linear_optimization_fanduel.R
library(lpSolve)
preds$team <-as.character(preds$team)
obj = preds$prediction
con <- rbind(t(model.matrix(~ FD.Position + 0,preds)), t(model.matrix(~ team + 0, preds)), rep(1,nrow(preds)), preds$Salary)
dir <- c(">=",">=",">=",">=",">=",rep('<=',length(unique(preds$team))),"<=","<=")
rhs <- c(1,2,2,2,2,rep(4,length(unique(preds$team))),9,60000)
result = lp("max", obj, con, dir, rhs, all.bin = TRUE)
preds[which(result$solution == 1),]
@tcash21
tcash21 / server.R
Created Jan 18, 2016
Reddit Live Game Thread Swears by Fanbase Dashboard
View server.R
library(stattleshipR)
library(ggplot2)
library(dplyr)
library(shiny)
library(shinydashboard)
library(RCurl)
## get a free Stattleship API token from www.stattleship.com
set_token("stattleship-token")
You can’t perform that action at this time.